admin管理员组文章数量:1336659
So I have a table on which I want to capture its scroll event as we capture scroll event
on window
. I want to capture scroll event when its body scrolls as it as some fixed
height and overflow:scroll
will be preset:
Fiddle here
Below is what I've tried but with no success:
$('tbody').on('scroll',function(){
alert('hellow');
});
I am not sure the above code is correct or not. I mean not sure whether there is any event
like this for table
.
Are there any alternatives to capture scroll events of table body
. The main reason being here is fixed table header which works fine in chrome and other browsers but not in IE8 as it jumps and takes time to get fixed again!
So I have a table on which I want to capture its scroll event as we capture scroll event
on window
. I want to capture scroll event when its body scrolls as it as some fixed
height and overflow:scroll
will be preset:
Fiddle here
Below is what I've tried but with no success:
$('tbody').on('scroll',function(){
alert('hellow');
});
I am not sure the above code is correct or not. I mean not sure whether there is any event
like this for table
.
Are there any alternatives to capture scroll events of table body
. The main reason being here is fixed table header which works fine in chrome and other browsers but not in IE8 as it jumps and takes time to get fixed again!
2 Answers
Reset to default 4Try this, that have to work in IE8:
$('tbody').bind('mousewheel DOMMouseScroll', onWheel);
function onWheel (e){
console.log(e);
}
jsFiddle
There is another way to trigger this event. The table from which you want to apply this event, from there itself you can call a JavaScript function.
For example:
<table onscroll="yourFunction()"></table>
and then you can write your code in the yourFunction() function in the script tags.
本文标签: javascriptapplying scroll events on table bodyStack Overflow
版权声明:本文标题:javascript - applying scroll events on table body - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742419614a2471392.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论