MDA/MDD/TDD/DDD/DDDDDDD
          posts - 536, comments - 111, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          公告

          一些零碎的筆記,希望能對你有用處。


          搜索

          •  

          積分與排名

          • 積分 - 596159
          • 排名 - 80

          最新評論

          jquery插件開發

          Posted on 2008-05-08 13:19 leekiang 閱讀(644) 評論(1)  編輯  收藏 所屬分類: 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/

          評論

          # re: jquery插件開發[未登錄]  回復  更多評論   

          2010-05-21 13:19 by 訪客
          穿參時應該可以這樣寫:
          callback : test

          test(){

          }
          主站蜘蛛池模板: 洮南市| 莱芜市| 铁力市| 中方县| 襄汾县| 黔西| 比如县| 如皋市| 万州区| 吴桥县| 上高县| 岳池县| 班玛县| 和林格尔县| 喀什市| 太仓市| 黄浦区| 遂川县| 茌平县| 绵竹市| 汝南县| 龙口市| 鱼台县| 北海市| 中牟县| 如皋市| 云林县| 丰都县| 新乡县| 黄浦区| 武强县| 新宾| 新密市| 大化| 金门县| 德江县| 新巴尔虎左旗| 东丽区| 十堰市| 贵德县| 砀山县|