jQuery: how to scroll to certain anchor/div on page load?

The Solution to jQuery: how to scroll to certain anchor/div on page load? is


Use the following simple example

function scrollToElement(ele) {
    $(window).scrollTop(ele.offset().top).scrollLeft(ele.offset().left);
}

where ele is your element (jQuery) .. for example : scrollToElement($('#myid'));

~ Answered on 2012-03-18 10:42:06


Most Viewed Questions: