2010-03-13 2 views
0

도움을 주시면 대단히 감사하겠습니다. 이 기능을 플러그인으로 변경하는 올바른 마크 업은 무엇입니까? 나는 노력했다. 그러나 그것을 기울인다.플러그인에 대한 jquery 변경 기능 코드

$ (문서) .ready (함수() {
$ ('ul.tabNav의 A'). 클릭 (함수() {
VAR curChildIndex = $ (이) .parent(). prevAll() (현재); $ (this) .parent(). addClass ('current() .length + 1;
$ (this) .parent(). ');
$ (this) .parent(). parent(). next ('. tabContainer ') children ('. 현재 ') slideUp ('fast ', function() {
$ (this) ('current');
$ (this) .parent(). children ('div : nth-child ('+ curChildIndex + ')'). slideDown ('normal', functi on() {
$ (this) .addClass ('current');
});
});
return true;
});
});

답변

0
(function($) { 

    jQuery.fn.pluginName = function() { 

      return this.each(function() { 

         Your Code; 
     }); 
    }; 
})(jQuery); 
+0

매우 명확한 답변을 주셔서 감사합니다. 하지만 정확히 내 HTML 내에서 플러그인을 어떻게 호출합니까? –

+0

내 질문에 대한 답변이 담긴이 포럼에 simular 질문이 있습니다. 당신의 도움을 주셔서 감사합니다. http://stackoverflow.com/questions/2157651/help-turning-jquery-script-into-a-plugin –

관련 문제