user3386779 user3386779 - 1 month ago 6x
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},


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()},