Having trouble scrolling a fixed position div on the page?
Are you using this jquery script:
$('html, body').animate({
scrollTop: $(".example").offset().top
}, 750);
I had to set the body overflow property to hidden for another issue.
The problem: The above code doesn't work within a fixed position div. I need to scroll to an element inside a fixed positioned div.
<div class="overlay">
<div class="example"></div>
</div>
.overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
I can't scroll to the example element inside the overlay div due to its fixed position.
Using the code below:
$('html, body').animate({
scrollTop: $(".example").offset().top
}, 750);
It doesn't work within the fixed position overlay div.