Js Framework (jQuery)
In the front-end learning, I learned two kinds of JS framework.
With the traditional JS Framework : jquery,jquery has been optimized and improved over 10 years since its inception, and has been very mature and used by most front-end personnel. , all of jQuery is what we have to master.
There are more new js frame : Angular-js,angular-js 's ideas are relatively novel, the method is also with jQuery completely different, after 5 years of construction,angular-js also began to popular, and now a lot of people began to use.
Jquery:
jquery is fundamentally a javaScript Library of functions that encapsulate functions of various methods, andjquery greatly simplifies JavaScript Programming. In the construction of the project, most will use it (jQuery) to write code. In your work unit, you will also be required to use jQueryIf you are asked to master JavaScript .
jquery and the core is to find the object that added the event with $ () and then add the event to the jquery wrapper function.
Jqueryhas a powerful selector, not justJSsome of those.ID,FindClassName,Findname,FindTagNamethese kinds. The selector has a clear logic, such asJSnot in:Parent>childis to match all child elements under a given parent element,Prev+nextis to match all immediatelyprevelement after theNextelements, and even numbers of functions that match cardinality even items: Evenand Cardinality: Odd,: eq (index)is the element that matches a given index value, which simply means finding the first element. There are also a number of logical selectors, specifically to find outJQuerydocumentation, the selector is good for code editing, and it's much easier to find the object you want to manipulate.
JQuery is also very powerful in Dom, and it has a lot of document handling functions, and here are a few more common ones.
1:Append (CONTENT|FN) is to append content to each matched element, in Js as if it were executed on the specified element appendchild methods to add them to the document. () is the content to be added. The added method is also appendTo () it differs from append ( ) in that the position of the object is added,appendTo () is preceded by the add content, followed by the Add object.
2:after () and before ( ) after () are inserted after the matching element, while the before () is to insert the content before the element.
3:empty () is the deletion of all child nodes in the collection of matching elements.
4:remove() removes all matching elements from the DOM.
JQuery has a lot of useful filtering functions, which makes it very convenient for us to filter elements. For example:
1:eq () is the nth element that gets a label .
2:first() and last () respectively, are to get the initial and final element.
3:has () is a reserved element that contains a specific descendant, removing those elements that do not contain the specified descendants.
4:Next () gets a collection of elements that contain a matching set of elements that are immediately behind each element in the next sibling element.
5:nextall () finds all sibling elements after the current element.
JQuery also has a number of common event-encapsulated functions. For example
1:The onload that runs the code after loading inJS is in jQuery with ready () . .
2:bind (TYPE,FN) is an event handler that is bound for an element,type is the event name.
3:change () is the event that triggers an element only when it has changed
4" and "js jquery For example hover () blur () , click () , focus () , mousedown () and so on.
The animation of JQuery is added, for example: more powerful to create custom animations: animate (Params,[speed],[fn]) , the params is an animated property and style property,speed is the animation time in milliseconds, andfn is the function that executes after the animation completes.
JS Framework (JQuery)