1. Basic information on jquery:
1.1 Definition: jquery is one of the JavaScript libraries, it is the encapsulation of JavaScript objects and utility functions,
1.2 Effects: Many interactive effects that can be implemented using JavaScript, which are perfectly implemented using jquery, are understood by five purposes.
1.2.1 Access and manipulation of DOM elements
1.2.2 Make page style
1.2.3 The processing of page time
1.2.4 Easy to use the jquery plugin
The perfect combination of 1.2.5 and Ajax
1.3 Advantage: Someone would ask: why do people choose jquery more? Because the gist of jquery is Wrute less,do more (with less code, more functionality),
It has unique selectors, chain operations, event-handling mechanisms and encapsulation, and perfect Ajax are all other JavaScript crying.
2.jQuery Related applications:
2.1 If you want to refer to the jquery library in the page, just place the downloaded jquery library in the directory JS, and use the relative path for general reference. jquery's keyword "$"
2.2 Syntax and cases of related functions
The function module that 2.2.1 waits for the HTML page to parse after all documents are finished
$ (document). Ready (function () {
alert (message);//function, event module
});
Abbreviated version
$ (function () {
alert (message);//function, event module
});
2.2.2 Factory function $ ()
$ () Action 1: Converts a DOM object into a jquery object, because the jquery method can be used only after the DOM object has been converted to a jquery object (the jquery method is unique)
$ (function () {
//convert jquery to DOM object
var dom = $ ("#mli") [0];
You can then call the DOM's property
Dom.innertext;
Converts a DOM object to a jquery object
var $dom = $ (DOM);
The method of calling its Jquerry with a jquery object
$dom. Text ();
$ () Effect 2: Registers events by obtaining the selector name and then giving the selector the corresponding content
The mouse moves over the label and removes the two event
//jquery unique consonant effect
$ (function () {
$ ("Li"). MouseOver (function () {
$ (this). CSS (" Background "," green ");
Mouseout (function () {
//this.style.background = "";
This.style.cssText = "background:"
;}); Click event
$ (function () {
$ ("H2"). Click (function () {
$ ("H2"). CSS ({"font-size": "50px", "Color": "Red"});
$ ("P"). css ({"font-size": "30px", "Color": "Red", "Padding-left": "1px", "Line-height": "30px"});}
);
3. Several classic cases of timer
3.1 Picture Auto Switch
3.2 Countdown (can start, stop, continue)
3.3 Get the current time and start the timer run
//in front of the number less than 10 with a 0
function checktime (i) {
if (I <)
{i = "0" + i} return
i
}
</ script>
Above the jquery base of the factory function and timer of the classic example analysis is small series to share all the content, hope to give you a reference, but also hope that we support cloud habitat community.