Swiper not working (ReferenceError: Swiper is not defined)
-
NOTE: I have the brand logos carousel in a syncd-pattern, i think the check in enqueue_assets() only anticipates blocks directly on the page, but doesn’t follow the patterns. See https://github.com/WordPress/gutenberg/issues/18272
In an earlier support post you had suggested ‘make sure swiper is enabled in settings’. But I have no settings on the plugin that i can see.
“frontend.js?ver=722b6c4…:1 Uncaught ReferenceError: Swiper is not defined at frontend.js?ver=722b…3593f2d194f5c:1:226 at NodeList.forEach (<anonymous>) at frontend.js?ver=722b…3593f2d194f5c:1:136”
is shown on my home page (where i have a brand logos carousel), and, this in turn is from below, where new Swiper() fails, Swiper being undef. I don’t see any js enqueued, should I?
window.addEventListener("DOMContentLoaded", (()=>{
const e = document.querySelectorAll(".wp-block-gutsliders-logo-carousel");
e.length > 0 && e.forEach((e=>{
const o = e.querySelector(".swiper")
, t = e.dataset.swiperOptions
, r = JSON.parse(t);
new Swiper(o,r)
}
))
}
));
- You must be logged in to reply to this topic.