2012-01-14 82 views
0

我在使用getScript在jquery加載完成時觸發腳本。僅在某些頁面上停止加載腳本

$(document).ready(function() { 
    $.getScript("js/hscroll.js"); 
}); 

當一個項目完成後,我可以創造與其他功能:當一個項目加載

$(document).bind("projectLoadComplete", function(e, pid){ 
    // turn off script 
}); 

我如何關閉hscroll.js腳本?

感謝

+2

可能重複? http://stackoverflow.com/questions/4669065/unload-files-loaded-with-getscript – Zakaria 2012-01-14 17:55:25

+0

所以這是不可能的/不應該做的。我想刪除這個腳本的影響。 – uriah 2012-01-14 18:03:34

回答

0

如果您hsrcoll.js代碼爲this one,那麼它的初始化代碼:

/* Initialization code. */ 
if (window.addEventListener) 
     window.addEventListener('DOMMouseScroll', wheel, false); 
window.onmousewheel = document.onmousewheel = wheel; 

這意味着你可以用這個卸載它:

/* Unhook code. */ 
if (window.removeEventListener) { 
     window.removeEventListener('DOMMouseScroll', wheel, false); 
} 
window.onmousewheel = document.onmousewheel = null; 

如果這不是你的hscroll.js,那麼請發佈一個你正在使用的引用,以便我們可以看看它。

+0

我忘了給我的感謝,我沒有看到初始化代碼,我不知道正確的解鎖方式。非常感謝你。 – uriah 2012-01-19 11:27:40

相關問題