how do I define where my scroll animation (jquery) should end up as a string on the page

0

Hello, I would like to know how to define a location where the one-page scrolling effect should stop. The problem I face is that by clicking on one of the links in my navigation menu in the header the automatic scrolling scrolls to the desired content but cuts parts of it as the title of the content, as I define where it should stop. >

Please note that this is a well-crafted question.

    
asked by anonymous 02.04.2018 / 20:55

1 answer

0

In the final position you switch to for the animate function, you need to subtract the height of this fixed heading. That is, the coordinate is going to be the ContentType - HeightHeader .

For example:

$("html, body").animate({ 
    scrollTop: $(#sobre-nos).offset().top - $('#topo').outerHeight() 
}, 1000);
    
02.04.2018 / 21:04