滚动到< div>的底部在页面加载时使用jQuery(多个< div>) [英] Scroll to bottom of a <div> with jQuery on page load (multiple <div>)
本文介绍了滚动到< div>的底部在页面加载时使用jQuery(多个< div>)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道这已经在这里得到解答滚动到底部Div on page load(jQuery),但当多个高度不同的<div>
时,此解决方案不起作用.
I know this has been answered here Scroll to bottom of Div on page load (jQuery), but this solution is not working, when having more than one <div>
with different heights.
$('.myContent').scrollTop($('.myContent')[0].scrollHeight);
不能与具有不同高度的多个<div>
一起使用!
Is not working with multiple <div>
with different heights!
请参见 http://jsfiddle.net/4pfLQ/
推荐答案
尝试一下:
$('.myContent').each(function () {
$(this).scrollTop($(this)[0].scrollHeight);
});
这篇关于滚动到< div>的底部在页面加载时使用jQuery(多个< div>)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文