Question

Is there a Dojo method that wraps window.onscroll?

I want to be able to capture the page scrolling. I can capture the mousewheel but can't seem to find any reference to capturing the actual page scroll. I've tried lots of variations but the event just doesn't seem to fir at all.

any ideas?

Was it helpful?

Solution

dojo.connect(window, 'onscroll', this, function(event) {
    var scrollTop = dojo._docScroll().y;

    //code to handle scroll
});

This works for me whether the document is scrolled via mousewheel, scrollbar, or up/down keys, which just about covers all scroll scenarios.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top