flo*_*eft 7 jquery offset scrolltop jquery-animate
我正在使用以下内容滚动到<li>无序列表中的最后一个:
$("html,body").animate({scrollTop: $('ul#cart-items li').offset().top});
如何更改此选项以滚动到<li>无序列表中的最后一个,但也从顶部偏移约30px?
Kai*_*ing 11
你试过这个:
$("html,body").animate({scrollTop: $('ul#cart-items li:last').offset().top - 30});
Run Code Online (Sandbox Code Playgroud)
但+或 - 最后的30,以实现您想要的偏移?