What is the issue with using vw and vh as a unit in Javascript, i cant get it to be smooth even with requestAnimationFrame. Here is the actual working example(not so smooth). https://nikoladim123.github.io/portfo/ (no solutions yet)
function scrolerTwo() {
var bottomOne = document.querySelector('.bottom-slider');
var stopid;
var x = 1;
var swch;
function step(){
stopid = window.requestAnimationFrame(step);
if (i < 30) {
bottomTwo.style.zIndex = 1;
bottomThree.style.zIndex = 0;
bottomFour.style.zIndex = 0;
x = -x;
swch = 1;
}
i -= x;
if (swch == 1 && i >= 70) {
cancelAnimationFrame(stopid);
swch = 0;
}
bottomOne.style.top = i + 'vh';
};
step();
}