Hi, It’s been awhile since I try to add Swiper (http://idangero.us/swiper/get-started) to my Grav website,
They say to add this html code
— html
{% endblock %}
{{ assets.css() }}
{% block javascripts %}
{% do assets.addJs('theme://js/swiper.min.js') %}
{% endblock %}
{{ assets.js() }}
{% endblock head %}
Then they say to add this code to html layout
--- html
<!-- Slider main container -->
<div class="swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
...
</div>
<!-- If we need pagination -->
<div class="swiper-pagination"></div>
<!-- If we need navigation buttons -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<!-- If we need scrollbar -->
<div class="swiper-scrollbar"></div>
</div>
So I added this one to the user hemes\antimatter emplates\home.html.twig just before the {% endblock %} and .
I also added what is necessary on the user hemes\mytheme\css\home.css
— css
.swiper-container {
width: 600px;
height: 300px;
}
Then they say:
---
Finally, we need to initialize Swiper in JS. There are few options/places to do that:
The best option will be in inline script or in script file that is included in the very end of body (right before closing </body> tag):
<script>
var mySwiper = new Swiper ('.swiper-container', {
// Optional parameters
direction: 'vertical',
loop: true,
// If we need pagination
pagination: '.swiper-pagination',
// Navigation arrows
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
// And if we need scrollbar
scrollbar: '.swiper-scrollbar',
})
</script>
</body>
But I don’t know where I need to place that and actually the slideshow looks like this:
Capture30
I can’t click anywhere on the slideshow and slide doesn’t slide.
Thank so much in advance for who can help me