Home  >  Article  >  Web Front-end  >  How to use jQuery plugins

How to use jQuery plugins

coldplay.xixi
coldplay.xixiOriginal
2020-12-24 14:06:183010browse

How to use the jQuery plug-in: first set the available demo; then use the webkit kernel or firefox to view breakpoints; finally write the plug-in framework, the code is [(function($){$.fn.extend( {fnKey:function(){}})】.

How to use jQuery plugins

The operating environment of this tutorial: windows7 system, jquery1.10.0 version, DELL G3 computer.

Recommended: jquery video tutorial

##How to use the jQuery plug-in:

1. If you want to use the jQuery plug-in, there is usually a demo or API in the plug-in, which you can check. Usually, the jQuery plug-in will release two versions, XXX.js and XXX.min.js, in order to reduce the size. If you want to modify the plug-in, you need to use the XXX.js file.

How to use jQuery plugins

2. First you need to know how to use it. First have an available

demo (if there is no demo, just write one yourself), and then use the webkit kernel Or firefox for breakpoint viewing. This is mainly to find the plug-in entry point. Of course, you can also directly view the js code. This requires a certain foundation. Finally, you need to slowly view the implementation function of his code. You must first understand how it is implemented. , and then you will know how to change it.

How to use jQuery plugins##3. I have also written a lot of jQuery plug-ins, such as simulating alert/confirm/prompt error message prompt boxes and simulating pop-up forms. Seamless marquee scrolling paging control dragging control, etc.

How to use jQuery plugins4. The framework of jQuery plug-in is usually written as

(function($){$.fn.extend( {fnKey:function(){}})

//or $.fn.fnKey=function(){}})(jQuery)The calling method of the above two methods is $(" XXX").fnKey() to call

How to use jQuery plugins5, there is another way to write:

var fnClass = function(){this.fnKey=function(){ }this.props="";}

The calling method of this writing method isfnClass obj = new fnClass();obj.fnKey();The second writing method is object-oriented programming of js You have to understand it slowly by yourself

How to use jQuery plugins

Related free learning recommendations:

javascript learning tutorial

The above is the detailed content of How to use jQuery plugins. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn