user3386779 user3386779 - 1 year ago 99
jQuery Question

scroll top to given position

I have fixed header for 16vh.I want to scroll my div 'sample' to top :16vh using jquery.I tried to scroll to top and stick after 16vh.
I want to leave 16vh space above after scroll. i.e)instead of stick to top 0 to stick to stick at 16vh.

scrollTop: $("#block-views-customerspeak-block").offset().top},

Answer Source

You basically need to extract the height of your header from whole height, something like this:

    scrollTop: $("#block-views-customerspeak-block").offset().top - $('.your-header').height()},
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download