【发布时间】:2016-10-28 09:19:31
【问题描述】:
我正在开发一个 jQuery 函数,该函数在单击时滚动到 div。现在它会滚动到顶部,我想知道他们是否可以让它滚动到$('.scrollit') 的中心而不是顶部,或者可能是一种将其偏移一些像素量的方法?
$(".playbox").on('click', function () {
$('.scrollit').animate({
scrollTop: $(this).offset().top
}, 1000);
【问题讨论】:
-
类似的tyoe问题答案在这里。 stackoverflow.com/questions/3898130/…我想对你有帮助