I am trying to get this work on my WP page but it won't work. I have downloaded the stable release from here and added siema.min.js file in wp-includes/js/slider/siema.min.js and I first tried calling the file on the page by adding a script tab src and path. But it didn't work and than I added through Insert Header footer plugin. But it still doesn't work, rather is shows an image below the other.
HTML
const mySiema = new Siema();
const prev = document.querySelector('.prev');
const next = document.querySelector('.next');
prev.addEventListener('click', () => mySiema.prev());
next.addEventListener('click', () => mySiema.next());
body {
width: 100%;
max-width: 30rem;
margin: 0 auto;
}
img {
width: 100%;
}
.siema {
margin: 1rem 0;
}
<div class="siema">
<div><img src="https://pawelgrzybek.com/siema/assets/siema--pink.svg" alt="Siema image" /></div>
<div><img src="https://pawelgrzybek.com/siema/assets/siema--yellow.svg" alt="Siema image" /></div>
<div><img src="https://pawelgrzybek.com/siema/assets/siema--pink.svg" alt="Siema image" /></div>
<div><img src="https://pawelgrzybek.com/siema/assets/siema--yellow.svg" alt="Siema image" /></div>
</div>
<button class="prev">Prev</button>
<button class="next">Next</button>
Webpage in quesiton.
You need to at least provide a selector to initialize
SiemaHere you'll find other options available.
Note: when you visit your website, there is an error in the browser console saying this. Also, don't forget to put your scripts inside a
$(document).ready(function(){});Snippet:
Update from comments
Your page has a few errors and and a lot of warnings about non unique id
For now, it's hard to find the later errors, but the first one is causing your siema carousel not to work.
Your error says:
And your code is:
That error means you have html tags in your script and a
<is not expected at that position. Remove those<p>tags from the siema initialisation script. and it should work.