I have a website on ovh web hosting. My website have a carousel in js. My carousel is working on local developpement but when I transfer my files on my online website, it's not working anymore. When I test to check if the script is executed, it doesn't, so I think that's an issue in my eventListener but I can't figure out why.
Here my function what I call in my main.js file
document.addEventListener('DOMContentLoaded', function () {
new Carousel(document.querySelector('#carousel1'), {
slidesToScroll: 1,
slidesVisible: 2,
loop: false
})
})
and here how I call it in my index.html file :
<script type="text/javascript" src='./js/main.js'></script>
That's my carousel in the index.html file :
<div id="carousel1" class="total-carousel mb-4">
<!-- PROJECT 1 -->
<div class="d-flex flex-column carousel-box">
<h3 class="w-100 text-center mb-0 contact-bg project-title">Transformation d'un CV en site web
</h3>
<div class="w-100 text-center project-image">
<img class="w-100" src="assets/images/projet2.png">
</div>
</div>
<!-- PROJECT 2 -->
<div class="d-flex flex-column carousel-box">
<h3 class="w-100 text-center mb-0 contact-bg project-title">Transformation d'un CV en site web
</h3>
<div class="w-100 text-center project-image">
<img class="w-100" src="assets/images/projet2.png">
</div>
</div>
<!-- PROJECT 3 -->
<div class="d-flex flex-column carousel-box">
<h3 class="w-100 text-center mb-0 contact-bg project-title">Transformation d'un CV en site web
</h3>
<div class="w-100 text-center project-image">
<img class="w-100" src="assets/images/projet2.png">
</div>
</div>
</div>