JQuery: scroll to the end <li>
I use the following to scroll to the last <li>
in an unordered list:
$("html,body").animate({scrollTop: $('ul#cart-items li').offset().top});
How can I change this to scroll to the last <li>
in the unordered list, but also shift it about 30 pixels from the top?
+7
floatleft
source share2 answers
Have you tried this:
$("html,body").animate({scrollTop: $('ul#cart-items li:last').offset().top - 30});
but + or - 30 at the end to achieve the desired offset?
+9
Kai qing
source share $("html,body").animate({scrollTop: $('ul#cart-items li:last').offset().top+30});
Here it is..
+1
Tolga arican
source share