Dojo [removed]

2019-08-20 05:58发布

问题:

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?

回答1:

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.



标签: dojo onscroll