0
I’m trying to make this code to change the element when it reaches the top, the element will stay fixed until the next one reaches the top.
HTML
<p>
elemento A
</p>
<p>
elemento B
</p>
<p>
elemento C
</p>
JS
function scroll() {
(window).scroll(function() {
if ($(window).scrollTop() > elementPosition.top) {
$('p').css('position', 'fixed').css('top', '0');
} else {
$('p').css('position', 'static');
}
});
}