Learn Blog Links:
①https://www.cnblogs.com/cyStyle/
② https://www.cnblogs.com/chengyunshen/p/7277305.html
③ https://www.cnblogs.com/sjqq/p/6410839.html
< The development of the span class= "ql-author-11805412" >jquery plugin includes two types:
< Span class= "ql-author-11805412" to (1) class-level plug-in development, which adds new global functions to jquery, the global function of jquery is a function that belongs to the jquery namespace, which is equivalent to adding a method to the jquery class itself.
< Span class= "ql-author-11805412" >
< Span class= "ql-author-11805412" > (2) object-level plug-in development, adding methods to jquery objects.
The big guy's experience (first link):
(1) Put all the code in the closure (the closure is equivalent to a private scope, external access to internal information, and there is no global variable pollution)
(2) provides default parameter options for plug-ins
(3) traversing multiple elements and returning (sizzle selector engine, chained call)
(4) One-time code is placed outside the main loop
(5) defining public and private methods (increasing the robustness of the code)
(function($) { /// within the plug-in container, define a private method function// code here//var methods = // code here };}) (jQuery);
(6) Add persistent data ($.data function adds information to element), $.removedata function to delete corresponding data
Learning Summary: jquery plugin development model and structure