Scroll to the element

This jquery script is very useful when you show some element on a webpage and then you can use this script to scroll right away to the top of this element. You can trigger this with a button or embed the code in your script. This is from internet and you can search for it but I will put it right here for my own reference and for any others who will find it useful:

$(‘html, body’).animate({
scrollTop: $(“#element_to_Scroll_To").offset().top
}, 2000);

Posted in 未分類