0
我有一个div
与2滚动。我喜欢滚动到结束时向用户显示一条消息。在Firefox中检测滚动到底部2滚动
这是我的div:
<div id="scrollbox">
<div>this is a test.this is a test.this is a test.this is a test</div>
<div>this is a test.this is a test.this is a test.this is a test</div>
<div>this is a test.this is a test.this is a test.this is a test</div>
<div>this is a test.this is a test.this is a test.this is a test</div>
<div>this is a test.this is a test.this is a test.this is a test</div>
<div>this is a test.this is a test.this is a test.this is a test</div>
<div>this is a test.this is a test.this is a test.this is a test</div>
<div>this is a test.this is a test.this is a test.this is a test</div>
<div>this is a test.this is a test.this is a test.this is a test</div>
<div>this is a test.this is a test.this is a test.this is a test</div>
<div>this is a test.this is a test.this is a test.this is a test</div>
<div>this is a test.this is a test.this is a test.this is a test</div>
</div>
,这是我的CSS:
#scrollbox {
width: 300px;
height: 150px;
overflow: auto;
}
,这我的javascript:
$(document).ready(function() {
$("#scrollbox").scroll("scroll",function() {
if ($(this).scrollTop() + $(this).outerHeight() >= $(this)[0].scrollHeight) {
alert(1);
}
});
});
当DIV有一个滚动的一切运作良好。 我已经让你可以看到。 http://jsfiddle.net/L5f7qtux/
但是,当div有两个滚动是有问题的。 问题是,当滚动到结尾时,几个消息显示给用户。 我已经让你可以看到。 http://jsfiddle.net/L5f7qtux/1/
注意:此问题仅在Firefox浏览器中。
感谢它的工作。 [http://jsfiddle.net/L5f7qtux/2/](http://jsfiddle.net/L5f7qtux/2/) –
正确的地址是:[http://jsfiddle.net/L5f7qtux/3/](http ://jsfiddle.net/L5f7qtux/3/) –