In many sites that need to be searched, there will be a search box that is automatically completed. Make it easy for users to find the search terms they want. Help users quickly find the results they want. This way is more friendly. So it is more
Pop-up box in the Site page is an essential part of today, with the help of cloud Habitat Community platform to share the use of JS to achieve a simple pop-up box effect, this article is not good, please forgive me!
Let's first analyze the widget
This example for you to share the JavaScript simulation of the right mouse button menu of specific code for your reference, the specific code as followsEffect Chart:
Specific code:
right button menu &L
T;style type= "Text/css" > *
This article is to share the JavaScript implementation of the mobile end of the touch screen drag function, the specific contents are as follows
Effect Chart:
Implementation code:
touchstart,touchmove, Touchend,touchcancel
Nonsense said, mainly through the following seven aspects of the summary of the time to deal with the relevant knowledge.
1. Get Current time
function Getnowtime () {return
new Date ();
}
2. Time and Days added
function
First, the concept of Agent mode
Description: As the name implies is to use a class to replace another class to perform the method function, this pattern is somewhat similar to the decoration pattern, not the same, the proxy mode is to initialize
The Promise object is a unified interface provided by the COMMONJS workgroup for asynchronous programming, which provides native support for promise in ECMASCRIPT6, and promise is what happens in the future, and using promise avoids the layer
Today small make up some about the JavaScript to determine whether the variables are arrays (array) related knowledge, mainly through the following four points to start the topic, the specific content as follows:
1. Is typeof really that bad??
Recently the project used to "lazy load", now updated generally, because the main reason for the development of the mobile side, so the library file is used zepto.js. Of course, it can be universal with jquery.
The code is as follows:
/** *
Hello, friends. Today we will go on to the previous content, we have talked about inheritance, today we say OOP is the last embodiment, that is polymorphic, because JavaScript language flexibility, so we are no way to use the interface, so this also
Resource pre-loading component--preload
Queues to support queue loading and callbacks, or to load video or audio
Progress bar, you can dynamically get progress bar information
Support for pre-loading of IMG tags, add psrc properties
The most basic code of the player implementation has increased playlist, using makelist to achieve more than one play, the need to be used directly:
untitled page
MakeList parameter: A total of 3 parameters, the first is the ID,
This article to share the JS implementation of the Click button font magnification to reduce the example code, the code easy to understand, the need for friends to refer to the next bar
The specific code looks like this:
style switcher
A Web page content, will be split screen display data, if a lot of screen, the user access to the data has been to the bottom of the page, this time to return to the top is also a need for a few minutes. This may be a bit lame for the user
1. Compare two dates successively
var x = new Date (' 2015-05-25 ');
var y = new Date (' 2015-05-25 ');
if (x.gettime () = = Y.gettime ()) {
It ' ll be true;
}
2, whether in between two dates
var beforespringdate,
1. Why to get undefined?
Because undefined in JavaScript is not reserved words, can be user as a variable to assign value, so if we need to use the undefined to detect a variable, then the value of the detection is inaccurate;
Give me a chestnut:
Cause
If you usually do some front-end development work, there must be such experience: the page needs some effect or plug-in, we generally have two choices:1, the Internet to find the relevant JS plug-in, learning its usage2, build their own
This article for everyone to share the JavaScript implementation page load loading effect, for your reference, the specific content as follows
Effect Chart:
is loading is loading the home page, please wait .
The
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service