1. The JavaScript library
Warehouse: You can put a lot of things in this warehouse. All you have to do is go to the warehouse and look it up.
A JavaScript library, or library, is an encapsulated collection of specific methods and functions. A library encapsulates a bunch of predefined functions, such as animate, hide, show, and fetch elements.
Simple understanding: is a JS file, in the face of our native JS code encapsulated, stored in the inside. This allows us to use these encapsulated features quickly and efficiently.
JQuery, for example, is designed for quick and easy manipulation of the DOM, which is basically full of functions (methods).
Common JavaScript libraries: JQuery, Prototype, YUI, Dojo, Ext JS, Mobile zepto, etc., these libraries are the encapsulation of native JavaScript, internal implementation is JavaScript, we mainly learn jQuery.
2. Concept of jQuery
JQuery overview is as follows:
-
JQuery is a fast, concise JavaScript library designed to “write Less, Do More”, which advocates writing Less code and doing More.
-
J is JavaScript; Query Query; Meaning is query JS, the DOM operation in JS encapsulation, we can quickly query the use of the inside function.
-
JQuery encapsulates common JavaScript functionality and optimizes DOM manipulation, event handling, animation design, and Ajax interaction.
-
Learning the essence of jQuery: Learning to call these functions (methods).
-
The purpose of jQuery is to speed up the development of front-end staff, we can very convenient call and use it, so as to improve the development efficiency.
3. Advantages of jQuery
- Lightweight. The core file is only tens of kilobytes, so the page loading speed will not be affected.
- Cross-browser compatibility, basically compatible with the mainstream browser now.
- Chain programming, implicit iteration.
- Support for events, styles, and animations greatly simplifies DOM manipulation.
- Support plug-in extension development. There are plenty of third-party plug-ins, such as tree menus, date controls, and wheel maps.
- Free and open source.