I am making a custom module using Owl Carousel 2. For some reason it just doesn't work in Joomla. The html structure is there in frontend, but the owl carousel is not displayed.
Unfortunatly, there are no code snippets here in Joomla StackExchange, like we have on regular SE. But my code is rendered correctly.
CSS and JS are loaded properly using $document
:
$document->addStyleSheet('https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css');
$document->addStyleSheet('https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.css');
$document->addScript('https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js','text/javascript', true, false);
Html output:
<div class="owl-carousel owl-theme">
<div class="item">
<img alt="180px koala ag1" src="images/sampledata/parks/animals/180px_koala_ag1.jpg" />
</div>
<div class="item">
<img alt="180px wobbegong" src="images/sampledata/parks/animals/180px_wobbegong.jpg" />
</div>
<div class="item">
<img alt="200px phyllopteryx taeniolatus1" src="images/sampledata/parks/animals/200px_phyllopteryx_taeniolatus1.jpg" />
</div>
<div class="item">
<img alt="220px spottedquoll 2005 seanmcclean" src="images/sampledata/parks/animals/220px_spottedquoll_2005_seanmcclean.jpg" />
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".owl-carousel").owlCarousel(
loop:true,
margin:10
});
);
</script>
When moving this to a simple html file, it works fine (when adding jQuery). Just not in Joomla? I am using protostar template, so jQuery is enabled.
Additional info:
The slideshow is not visible because it is set to display:none
in css.
When I set it to block, I can see the images, but they are not sliding. So I asume there is a problem loading the JS. I have tried with and without defer, using CDN and local. Nothing I tried helps.
Anyone know what I am missing?
Thanks