Jquery Plugin模版
1. [代码][JavaScript]代码
01// remember to change every instance of "pluginName" to the name of your plugin!
02// the semicolon at the beginning is there on purpose in order to protect the integrity
03// of your scripts when mixed with incomplete objects, arrays, etc.
04;(function($) {
05
06 // we need attach the plugin to jQuery's namespace or otherwise it would not be
07 // available outside this function's scope
08 // "el" should be a jQuery object or a collection of jQuery objects as returned by
09 // jQuery's selector engine
10 $.pluginName = function(el, options) {
11
12 // plugin's default options
13 // this is private property and is accessible only from inside the plugin
14 var defaults = {
15
16 propertyName: 'value',
17
18 // if your plugin is event-driven, you may provide callback capabilities
19 // for its events. call these functions before or after events of your
20 // plugin, so that users may "hook" custom functions to those particular
21 // events without altering the plugin's code
22 onSomeEvent: function() {}
23
24 }
25
26 // to avoid confusions, use "plugin" to reference the
27 // current instance of the object
28 var plugin = this;
29
30 // this will hold the merged default, and user-provided options
31 // plugin's properties will be accessible like:
32 // plugin.settings.propertyName from inside the plugin or
33 // myplugin.settings.propertyName from outside the plugin
34 // where "myplugin" is an instance of the plugin
35 plugin.settings = {}
36
37 // the "constructor" method that gets called when the object is created
38 // this is a private method, it can be called only from inside the plugin
39 var init = function() {http://www.huiyi8.com/moban/
40
41 // the plugin's final properties are the merged default and
42 // user-provided options (if any)网站源码
43 plugin.settings = $.extend({}, defaults, options);
44
45 // make the collection of target elements available throughout the plugin
46 // by making it a public property
47 plugin.el = el;
48
49 // code goes here
50
51 }
52
53 // public methods
54 // these methods can be called like:
55 // plugin.methodName(arg1, arg2, ... argn) from inside the plugin or
56 // myplugin.publicMethod(arg1, arg2, ... argn) from outside the plugin
57 // where "myplugin" is an instance of the plugin
58
59 // a public method. for demonstration purposes only - remove it!
60 plugin.foo_public_method = function() {
61
62 // code goes here
63
64 }
65
66 // private methods
67 // these methods can be called only from inside the plugin like:
68 // methodName(arg1, arg2, ... argn)
69
70 // a private method. for demonstration purposes only - remove it!
71 var foo_private_method = function() {
72
73 // code goes here
74
75 }
76
77 // call the "constructor" method
78 init();
79
80 }
81
82})(jQuery);
Jquery Plugin模版的更多相关文章
- JQuery plugin ---- simplePagination.js API
CSS Themes "light-theme" "dark-theme" "compact-theme" How To Use Step ...
- jQuery plugin: Autocomplete 参数及实例
官网:jQuery plugin: Autocomplete (注:此插件已经不再更新.它的继任者是jQuery UI的一部分,) 此插件依赖于 jquery 1.2.6 --- j ...
- Signs of a poorly written jQuery plugin 翻译 (Jquery插件开发注意事项,Jquey官方推荐)
原文链接:http://remysharp.com/2010/06/03/signs-of-a-poorly-written-jquery-plugin/ 原文作者:remy sharp So far ...
- JQuery Plugin 1 - Simple Plugin
1. How do you write a plugin in jQuery? You can extend the existing jQuery object by writing either ...
- The ultimate jQuery Plugin List(终极jQuery插件列表)
下面的文章可能出自一位奥地利的作者, 列出很多jQuery的插件.类似的网站:http://jquerylist.com/原文地址: http://www.kollermedia.at/archiv ...
- [jQuery] 自做 jQuery Plugin - Part 1
有時候寫 jQuery 時,常會發現一些簡單的效果可以重複利用.只是每次用 Copy & Paste 大法似乎不是件好事,有沒有什麼方法可以讓我們把這些效果用到其他地方呢? 沒錯,就是用 jQ ...
- ollicle.com: Biggerlink – jQuery plugin
ollicle.com: Biggerlink – jQuery plugin Biggerlink – jQuery plugin Purpose Demo Updated for jQuery 1 ...
- Element DOM Tree jQuery plugin – Firebug like functionality | RockingCode
Element DOM Tree jQuery plugin – Firebug like functionality | RockingCode Element DOM Tree jQuery pl ...
- HTML5 Video player jQuery plugin
<!DOCTYPE html> <html lang="en" > <head> <meta charset="utf-8&qu ...
随机推荐
- 手机微硬盘读取速度>50MB/s eMMC技术浅析
转载:http://mobile.zol.com.cn/296/2968659_all.html#p2968659 手机微硬盘读取速度>50MB/s 在开始今天的话题之前,请大家随笔者一起时光倒 ...
- spring-boot实战【01】:Hello World项目搭建
原文:http://www.cnblogs.com/yucongblog/p/7355519.html 简介 在您第1次接触和学习Spring框架的时候,是否因为其繁杂的配置而退却了?在你第n次使用S ...
- Xcode: This device is no longer connected error
Quit the xcode and connect again will all right.
- openfire Android学习(一)----实现用户注册、登录、修改密码和注销等
以前学习过用Scoket 建立聊天,简单的建立聊天是没问题的,但如果要实现多人复杂的聊天,后台服务器代码就比较复杂,对于我这新手来讲就比较难了.后来在网上看到用openfire做服务器,利用强大的Sm ...
- 几个关于tableView的问题解决方式整合
近期遇到关于tableView的问题的整合.部分比較白痴.仅仅是初学easy犯~ 1.关于tableView左边空余15像素的问题. 2.关于tableView多余切割线隐藏的问题: 3.关于tabl ...
- 验证loadrunner对Ajax内容的校验
前一阵和开发的同事一起測试某个系统的性能.此系统是发送Ajax请求到后台,再调用第三方的某项服务. 第三方服务的性能由不得我们控制.因此开发者做了一下改进.超时则直接返回. 于是在loadrunner ...
- 手写JQuery 的框架的实现
JQuery的好处 快速上手(学习成本低) 开发效率高(选择器.批量操作 DOM.链型操作--) 一系列的封装(动画.ajax) 浏览器兼容(1.x版本 兼容IE6.7.8) JQuery 1.11. ...
- [Maven实战](9)传递性依赖
了解Spring的朋友都知道.创建一个Spring Framework项目都须要依赖什么样的Jar包.假设不使用Maven,那么在项目中就须要手动下载相关的依赖.因为Spring Framework又 ...
- 【课程笔记】比特币和数字货币技术[Bitcoin and Cryptocurrency Technologies] week1
源地址(可能要FQ):https://www.coursera.org/learn/cryptocurrency/home/welcome 1.1 Cryptographic Hash Functio ...
- 运维基础-Linux发展史、安装、基本操作
Linux是目前互联网运维.大数据.云计算方向首选操作系统平台,能够在物理服务器Dell.hp.等server,以及当前主流的云平台,阿里云,腾讯云上面部署 发展史 . . .略过..... 物理服务 ...