$(document).ready(function() { body = document.body; jsScroll = document.getElementsByClassName('pageScroll')[0]; currentPixel = window.pageYOffset; var speed = 0.1; var offset = 0; function smoothScroll() { offset += (window.pageYOffset - offset) * speed; var newPixel = offset; var diff = newPixel - currentPixel; var skewSpeed = diff * 0.1; var scrollTop = $(document).scrollTop(); var windowHeight = $(window).height(); jsScroll.style.transform = "translateY(-" + offset + "px) translateZ(0)"; $(".scrollElement").each(function(i,el){ var offset = $(el).offset().top; var elHeight = $(el).height(); $(el).css("transform","translateY("+((scrollTop-offset)/25)+"px)"); }); currentPixel = newPixel; setPageHeight(); requestAnimationFrame(smoothScroll); } smoothScroll(); $(window).on("resize", function(){ setPageHeight(); $(".dots").dotdotdot(); }); $(window).trigger("resize"); setTimeout(function(){ AOS.init({ offset: 100 }); $(".customSelect").select2({ minimumResultsForSearch: -1 }); $(".dots").dotdotdot(); }, 300); }); function setPageHeight(){ var height = $(jsScroll).outerHeight(); $("body").height(height); setTimeout(function(){ var height = $(jsScroll).outerHeight(); $("body").height(height); }, 600); }