JSFiddle - React, Tailwind, and code Playground
by gregborbonus
HTML
<a href="javascript:void(0);" id="vor" style="position:fixed;top:40px;">TEST</a>
<div style="height:2000px;">
Hi There
</div>
JavaScript
//Scroll Status abfragen}
$(window).scroll(function() {
wScroll = $(this).scrollTop(); //Get rid of var, so it can be used by functions outside of this function.
}); // That's all the work we need to do.
$("#vor").click(function() {
console.log('Called');
if (wScroll < 450) {
$('html, body').animate({
scrollTop: 450
}, 2000);
}
if (wScroll < 1900 & wScroll > 450) {
$('html, body').animate({
scrollTop: 1900
}, 2000);
}
});