【发布时间】:2021-05-01 17:09:28
【问题描述】:
我在 wordpress 网站上使用 locomotive.js (https://locomotivemtl.github.io/locomotive-scroll/)。 在我上传到实时服务器之前,它运行良好。在实时服务器上,元素有时会相互碰撞,然后闪烁并消失,页脚也会被切断。
我认为这一定与页面未加载有关,我需要使用 update() 来检查页面是否已加载。但我不确定如何更改它以检查页面加载而不是超时 - 任何人都可以帮忙吗?
function smooth() {
let scrollContainer = document.querySelector('your-selector');
scroll = new LocomotiveScroll({
el: scrollContainer,
smooth: true });
setTimeout(() => {
scroll.update();
}, 500);
}
【问题讨论】:
标签: smooth-scrolling locomotive-scroll