问题
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.
来源:https://stackoverflow.com/questions/14279343/dojo-window-onscroll