maybe this will help. Im using Vuejs in Nuxt and i had a similar issue.
You need to trigger the locomotive update() after the dom is loaded.
I was using graphql to pull in data from api so I had dynamic data that i had to wait for before locomotive could calculate the page height correctly.
Graphql apollo has a handy loading param that is either true or false.
My solution was to create a promse that checked if data was loaded using that param and then trigger the locomotive.update() to re-render the page height.
mounted() {
this.pageLoad();
},
method:
pageLoad() {
return new Promise((resolve, reject) => {
console.log("loading...");
setInterval(() => {
if (!this.$apollo.queries.projects.loading) {
resolve("data fetched");
}
}, 100);
})
.then((res) => {
console.log("loaded!", res);
this.filteredProjects = this.projects.nodes;
this.$refs.scroller.locomotive.update();
this.$refs.scroller.locomotive.scroll.reinitScrollBar();
console.log("loco updated");
})
.catch((err) => {
console.error("error: ", err);
});
},
once you have access to the locomotive instance you can tell it to update.
Hope that helps in some way.