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(){

          }
          主站蜘蛛池模板: 龙陵县| 平潭县| 镇雄县| 泽州县| 手游| 嘉荫县| 牟定县| 鄂温| 庆云县| 岑巩县| 大厂| 乌审旗| 东乌珠穆沁旗| 建瓯市| 蚌埠市| 崇阳县| 临安市| 任丘市| 卓尼县| 宝丰县| 咸丰县| 望奎县| 山东| 孝昌县| 禄劝| 上杭县| 通渭县| 云和县| 白银市| 马尔康县| 松原市| 盐源县| 通渭县| 德清县| 丹棱县| 潞西市| 壤塘县| 卓尼县| 凤庆县| 麻江县| 修武县|