div滚动条滚动时如何调用javascript函数 [英] how to call javascript function when div scrollbar is scrolled
本文介绍了div滚动条滚动时如何调用javascript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi ..
我想在div滚动上调用javascript函数.我想在div滚动并获取其当前滚动位置时调用javascript函数.提供解决方案.
thanx
hi..
i am trying to call javascript function on div scroll.i want to call javascript function when div scroll and get its current scroll position.provide solution.
thanx
推荐答案
请参考以下链接:
http://www.dhtmlgoodies.com/index.html?whichScript=scrolling_content [ ^ ]
http://www.dhtmlgoodies.com/index.html?whichScript=scrollable_div [ ^ ]
http://www.dotnetbull.com/2011/10/scrolling -div-content-with-javascript.html#.UFGG2pH1Tcc [ http://www.adp-gmbh.ch/web/js/scroll.html [ ^ ]
最后,请参见如何在滚动结束后调用函数? [ ^ ].
--Amit
Hi,
Refer the links below:
http://www.dhtmlgoodies.com/index.html?whichScript=scrolling_content[^]
http://www.dhtmlgoodies.com/index.html?whichScript=scrollable_div[^]
http://www.dotnetbull.com/2011/10/scrolling-div-content-with-javascript.html#.UFGG2pH1Tcc[^]
http://www.adp-gmbh.ch/web/js/scroll.html[^]
And finally see How to call a function after scroll has ended?[^].
--Amit
var parentDiv= document.createElement("div");
parentDiv.setAttribute("id", 'parentDiv');
parentDiv.onscroll = scrollfun;
函数scrollfun(){
//我的代码
}
parentDiv.onscroll = scrollfun;
function scrollfun() {
//my code
}
这篇关于div滚动条滚动时如何调用javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文