jquery插件开发

1,jquery插件开发模式
http://www.learningjquery.com/2007/10/a-plugin-development-pattern
There are a few requirements that I feel this pattern handles nicely:
(1)、Claim only a single name in the jQuery namespace
(2)、Accept an options argument to control plugin behavior
(3、Provide public access to default plugin settings
(4、Provide public access to secondary functions (as applicable)
(5、Keep private functions private
(6、Support the Metadata Plugin
(7,无论何时候,当你的代码出现each时,你应该重写代码来构造一个插件

2,jquery源码初步研究(插件扩展机制)
http://hi.baidu.com/uniquejava/blog/item/d55a2e12140f6953f819b821.html

3,传入回调函数的一种写法,不知可有更好的
   传参时的写法: callback:'test()'
   调用时的写法:
    if(options.callback) eval(options.callback);
  来源 http://www.heartstringz.net/blog/posts/view/jquery-countdown-plugin

4,(function($){
 $.fn.extend({
         plusin:function(opt,callback){
   return this;
         }
 })
})(jQuery);
 
(function($){
 $.fn.plusin = function(opt,callback){
  return this;
 }
})(jQuery);
请问这两种方式有什么区别
就这种情况而言,是没有区别。
当然extend有多个重载。
http://news.cnblogs.com/group/topic/2640/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值