仅在某些页面上停止加载脚本
问题描述:
我在使用getScript在jquery加载完成时触发脚本。仅在某些页面上停止加载脚本
$(document).ready(function() {
$.getScript("js/hscroll.js");
});
当一个项目完成后,我可以创造与其他功能:当一个项目加载
$(document).bind("projectLoadComplete", function(e, pid){
// turn off script
});
我如何关闭hscroll.js脚本?
感谢
答
如果您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
可能重复? http://*.com/questions/4669065/unload-files-loaded-with-getscript – Zakaria 2012-01-14 17:55:25
所以这是不可能的/不应该做的。我想删除这个脚本的影响。 – uriah 2012-01-14 18:03:34