Hello everyone, I'm trying to embed https://splidejs.com/ or https://swiperjs.com/ , but I have a problem regarding the initialization of both...
I've already tried importing the js/css of both within:
async function OnBeforeProjectStart(runtime)
{
// Code to run just before 'On start of layout' on
// the first layout. Loading has finished and initial
// instances are created and available to use here.
loadCSS("https://cdn.jsdelivr.net/npm/@splidejs/splide@4.1.4/dist/css/splide.min.css");
loadJS("https://cdn.jsdelivr.net/npm/@splidejs/splide@4.1.4/dist/js/splide.min.js");
runtime.addEventListener("tick", () => Tick(runtime));
}
function Tick(runtime)
{
// Code to run every tick
}
function loadCSS(url) {
var link = document.createElement("link");
link.rel = "stylesheet";
link.href = url;
link.crossOrigin = "anonymous";
document.head.appendChild(link);
}
function loadJS(url) {
var script = document.createElement("script");
script.src = url;
script.crossOrigin = "anonymous";
document.body.appendChild(script);
}
I have already tried adding it to the event sheet both when starting the layout and when completing the layout loading, neither of them work.
Is there any way to import this type of library into construct 3?