SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Mar 2002
    Location
    Los Angeles
    Posts
    325
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    quick how-to for capturing a page scroll event?

    Hello,

    Can anyone give me a quick how-to for firing off a function when the page is scrolled? I only need it for firefox. I tried to do:

    HTML Code:
    function onPageScroll(){
    	alert('test page scroll');
    }
    
    
    if (window.addEventListener)
            window.addEventListener('scroll', onPageScroll, false);
    }
    but that didnt work. any help is appreciated.
    From here on, it's instinctual...even straight roads meander.

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have two versions of Firefox, 1.0.2 and 1.5.0.7 (on WinXP). Both the following work in v1.5. In v1.02 they both work but only when you drag the scrollbar (doesn't work with scroll-wheel).
    Code:
      window.onscroll = listener1;
      window.addEventListener('scroll', listener2, false);

  3. #3
    SitePoint Addict
    Join Date
    Mar 2002
    Location
    Los Angeles
    Posts
    325
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks...i got it to work, but this error I am dealing with is actually occuring a hair before the scroll event is fired. Do you know if there is a way to capture an event for the scrollbar being released? The nearest I cant tell right now is that the order of events is mouse release > error occuring > scroll event.
    From here on, it's instinctual...even straight roads meander.

  4. #4
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That site requires flash.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •