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

          jquery插件開發

          Posted on 2008-05-08 13:19 leekiang 閱讀(647) 評論(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(){

          }
          主站蜘蛛池模板: 西华县| 博罗县| 嵊泗县| 临泉县| 剑阁县| 樟树市| 凌海市| SHOW| 嘉峪关市| 南安市| 锡林浩特市| 仙居县| 莒南县| 乌恰县| 平山县| 杨浦区| 三明市| 济南市| 兴城市| 迁安市| 永胜县| 木里| 图木舒克市| 东辽县| 沽源县| 淳化县| 英超| 永昌县| 永福县| 南郑县| 德兴市| 屏东市| 遵义市| 芜湖市| 荃湾区| 乌兰察布市| 百色市| 陕西省| 思茅市| 庄浪县| 舒兰市|