Doodled Doodled - 1 year ago 102
jQuery Question

Jquery scroll slowly to h1 tag minus 100 pixels on page load

I have a number of pages where I want the user to be aware there is content above the h1 tag (a search box) but not have to scroll past it every time to get to the content.

I know how to do a clickable link that will fire JQuery to scroll the page down to a specific id but I can't seem to find any way to:
1) scroll down on page load.
2) scroll to h1 rather than an element id.

Is it possible?


Ish Ish
Answer Source

Try this:

$(document).ready(function() {
        scrollTop: $('h1:first').offset().top
    }, 800, function() {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download