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 ...
随机推荐
- IIS下安装memcached管理工具—MemAdmin
1.先看这篇文章 http://www.cnblogs.com/joylee/archive/2013/01/07/memadmin.html . 2.在IIS下安装的php-cgi.exe程序版本为 ...
- uitableview中文排序问题
1,uitableview中涉及到排序的问题,查找资料后发现使用UILocalizedIndexedCollation可以很好处理中文和英文系统下中文的排序.而且如果第一个汉字首字母一样那么就会按照第 ...
- 邁向IT專家成功之路的三十則鐵律 鐵律二十三:IT人的成家之道-樸實
根據內政部一份2013年最新的調查報告指出台灣人的離婚率位居全球第三,想想看如果這是經濟成長率的排名表現那該有多好.然而究竟為何在台灣這塊小小的土地上,不僅離婚非常高而且晚婚的人也非常的多,其原因肯定 ...
- 【hibernate】hibernate和mybatis的比较
理解和学习,使自己在做项目中更加得心应手. 第一方面:开发速度的对比就开发速度而言,Hibernate的真正掌握要比Mybatis来得难些.Mybatis框架相对简单很容易上手,但也相对简陋些.个人觉 ...
- C语言-回溯例2
组合问题 组合:从n个不同元素中取r个不重复的元素组成一个子集,而不考虑其元素的顺序,称为从n个中取r个的无重组合,例如OR = {1,2,3,4}, n = 4, r = 3则无重组合为: {1,2 ...
- python(40)- 进程、线程、协程及IO模型
一.操作系统概念 操作系统位于底层硬件与应用软件之间的一层.工作方式:向下管理硬件,向上提供接口. 操作系统进行进程切换:1.出现IO操作:2.固定时间. 固定时间很短,人感受不到.每一个应用层运行起 ...
- ffmpeg 内存池
ffmpeg 部分内存管理采用 了内存池技术.基本的接口在libavutil目录下的buffer.c文件中实现: 1. av_buffer_pool_init 初始化 内存池 2 av_buffer_ ...
- ffmpeg rtmp 推流错误WriteN, RTMP send error 10053 10038
利用ffmepg推264流到rtmp服务端出现错误WriteN, RTMP send error 10053,具体如下图所示. 图1推流到rtmp服务错误 原因是视频流缺少SPS,PPS信息,加上这两 ...
- RobotFramework --RIDE介绍
RIDE是robotframework的图形操作前端,我们在RIDE上进行测试用例设计和编写测试脚本,并执行自动化测试.下面来全面的认识下这个操作工具. 在右边编辑页面有三大模块,Edit,TextE ...
- __del__删除方法
class dog: def __del__(self): print("删除机制被调用了...") dog1 = dog() del dog1 #在这里是先删除掉了,所以就去上面 ...