(function($){
$.fn.the_func = function() {
function my_func(){
alert('it works');
}
my_func();
// other code
};
})(jQuery);
$(window).load(function(){
my_func(); // This way?
$.the_func().my_func(); // Or this way? No?
$.the_func.my_func(); // No?
// ?
});
$(document).ready(function(){
$('div').the_func();
});
我如何可以調用它包裝它的功能外這個功能呢?
我想調用my_func()
就像這個代碼示例。
(窗口負載函數僅僅是一個例子。)
我想調用從「無處不在」 my_func()
無內the_func()
執行的其他功能或代碼。但我想使用the_func()
的變量。
With my_func()
我想更新存儲在參數the_func()
中的值。的Jquery/JS:調用jQuery的功能的功能外jQuery的功能
如何將它稱爲'$(「div」)。the_func(「my_func」)'?這會起作用嗎?我不同意你的當前解決方案的意思是......我的意思是,如果你會好起來的與語法,因爲這是我知道的熱來構建它,使你想 – Ian