0

I'm using getScript to fire a script when jquery has finished loading.

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

And when a project is complete I can create other functions with:

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

How can I turn off hscroll.js script when a project has loaded?

Thanks

Colin Brock
  • 21,267
  • 9
  • 46
  • 61
uriah
  • 2,485
  • 5
  • 28
  • 40
  • 2
    Possible duplicate ? http://stackoverflow.com/questions/4669065/unload-files-loaded-with-getscript – Zakaria Jan 14 '12 at 17:55
  • So this is not possible / shouldn't but done. I want to remove the effects of this script. – uriah Jan 14 '12 at 18:03

1 Answers1

0

If your hsrcoll.js code is this one, then it has initialization code like this:

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

That means you can deinstall it with this:

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

If this isn't your hscroll.js, then please post a reference to the one you're using so we can look at it.

jfriend00
  • 683,504
  • 96
  • 985
  • 979
  • I forgot to give my thanks, I didn't see the initialization code, I wouldn't know the correct way to unhook anyway. Thank you very much. – uriah Jan 19 '12 at 11:27