Dojo window.onscroll

半腔热情 提交于 2019-12-12 02:39:56

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!