Tiberiu-Ionuț Stan Tiberiu-Ionuț Stan - 1 year ago 106
Javascript Question

JavaScript `onscroll` event standalone (without frameworks)

I need a standalone JavaScript

event handler (without frameworks such as jQuery, Prototype, mootools, etc.), which is also cross browser.

I have searched for one, I can only find thousands of examples using jQuery or Prototype.

Answer Source

From element.addEventListener:

    function onScrollEventHandler(ev)

    var el=window;

        el.addEventListener('scroll', onScrollEventHandler, false);   
    else if (el.attachEvent)
        el.attachEvent('onscroll', onScrollEventHandler); 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download