@kalamakumaran said in invert carousel slide direction:
<script> window.laytheme.on("newpageshown", function(){ // Get the swiper-container element var $reverse = jQuery('.reverse'); if ($reverse.length > 0) { // Add the dir="rtl" attribute $reverse.find('.swiper-container').attr('dir', 'rtl'); } }); </script><script>
window.laytheme.on("newpageshown", function(){
// Get the swiper-container element
var swiperContainer = document.querySelector('.swiper-container');// Check if the element exists and has the "reverse" class
if (swiperContainer && swiperContainer.classList.contains('reverse')) {
// Add the dir="rtl" attribute
swiperContainer.setAttribute('dir', 'rtl');
}
});
</script>
maybe like this?
this needs to go into custom <head> content or custom html content. not custom css :D
But apparently it seems to be not possible to add classes to carousels. Is it a bug @arminunruh ?
i think this line of code doesnt work:
swiperContainer.classList.contains('reverse')
because .swiper-container is a child of .reverse
because the reverse class is added to .col