I have a page with several divs.
When the user clicks a button for a certain div which is half way down the page to be positioned centre so the top of the div is more like at the top of the page.
how do i do this using jquery?
I have a page with several divs.
When the user clicks a button for a certain div which is half way down the page to be positioned centre so the top of the div is more like at the top of the page.
how do i do this using jquery?
Try this
$("#button").click(function() {
$('html, body').animate({
scrollTop: $("#elementtoScrollToID").offset().top
}, 2000);
});
Also see jQuery scroll to element