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 ...
随机推荐
- 转 Tesseract-OCR 字符识别---样本训练
转自:http://blog.csdn.net/feihu521a/article/details/8433077 Tesseract是一个开源的OCR(Optical Character Recog ...
- systemtap学习笔记及疑问
http://blog.csdn.net/sunnybeike/article/details/7769663
- Golang协程与通道整理
协程goroutine 不由OS调度,而是用户层自行释放CPU,从而在执行体之间切换.Go在底层进行协助实现 涉及系统调用的地方由Go标准库协助释放CPU 总之,不通 ...
- Pixhawk之姿态解算篇(1)_入门篇(DCM Nomalize)
一.开篇 慢慢的.慢慢的.慢慢的就快要到飞控的主要部分了,飞控飞控就是所谓的飞行控制呗,一个是姿态解算一个是姿态控制,解算是解算,控制是控制,各自负责各自的任务.我也不懂.还在学习中~~~~ 近期看姿 ...
- 通过jstl判断是否给value 赋值
<input type="text" name="saler.password" id="password" value=" ...
- python(4)- 简单练习:python实现购物车的优化
购物车程序优化题目要求: 1. 用户退出时打印商品列表时,按以下格式 -------您购买的商品如下------ id 商品 数量 单价 总价 1 iPhone 2 ...
- python(26)- 面向对象补充Ⅱ
一 isinstance(obj,cls)和issubclass(sub,super) isinstance(obj,cls)判断obj是否是类 cls 的对象 class Foo(object): ...
- 关于position的小总结
position:relative/absolute/fixed/static ...... relative:相对定位. 脱离标准流,相对自己原来(标准流)的位置定位.absolute:绝对定位. ...
- Selenium系列之--05 录制脚本并导出
一.下载Firefox Firefox官方下载地址:http://www.firefox.com.cn/download/#more,下载延长支持版. 二.下载插件 Selenium本身有录制功能组件 ...
- .net 反射访问私有变量和私有方法 如何创建C# Closure ? C# 批量生成随机密码,必须包含数字和字母,并用加密算法加密 C#中的foreach和yield 数组为什么可以使用linq查询 C#中的 具名参数 和 可选参数 显示实现接口 异步CTP(Async CTP)为什么那样工作? C#多线程基础,适合新手了解 C#加快Bitmap的访问速度 C#实现对图片文件的压
以下为本次实践代码: using System; using System.Collections.Generic; using System.ComponentModel; using System ...