I'm using locomotive.js (https://locomotivemtl.github.io/locomotive-scroll/) on a wordpress site. It worked perfectly until I uploaded to a live server. On the live server the elements sometimes bump into each other and then flicker and disappear and the footer is also cut off.
I think it must something to do with the page not loading and I need to use update() to check whether the page is loaded. But I'm not sure how to change this to check for page load rather than timeout - can anyone help?
function smooth() {
let scrollContainer = document.querySelector('your-selector');
scroll = new LocomotiveScroll({
el: scrollContainer,
smooth: true });
setTimeout(() => {
scroll.update();
}, 500);
}
we have to detect images and large assets to load You should use imageLoaded to detect all image loading and after then you have to update the scroll and it should work fine