Created
July 15, 2022 10:56
-
-
Save wibawasuyadnya/396c7b5e11cb2db920e73cb32a8d075c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( function() { | |
var the_timer = setInterval( function() { | |
if( typeof Swiper && typeof jQuery ) { | |
runTheCode(); | |
clearInterval( the_timer ); | |
} | |
}, 100 ); | |
} )(); | |
function runTheCode() { | |
// add 'swiper-container' class to .elementor-container | |
jQuery( '.custom-swiper > .elementor-container' ).addClass( 'swiper-container' ); | |
// add 'swiper-wrapper' class to .elementor-row | |
jQuery( '.custom-swiper .swiper-container > .elementor-row' ).addClass( 'swiper-wrapper' ); | |
// add 'swiper-slide' class to each column | |
jQuery( '.custom-swiper .swiper-wrapper > div' ).addClass( 'swiper-slide' ); | |
// previous & next | |
jQuery( '.custom-swiper .swiper-container' ).append( '<div class="swiper-button-next"></div>' ).append( '<div class="swiper-button-prev"></div>' ); | |
// pagination | |
jQuery( '.custom-swiper .swiper-container' ).append( '<div class="swiper-pagination"></div>' ); | |
var swiper = new Swiper('.custom-swiper > .elementor-container', { | |
loop: false, | |
autoplay: { | |
delay: 15000, | |
disableOnInteraction: false, | |
}, | |
allowTouchMove: true, | |
parallax: true, | |
speed: 800, | |
navigation: { | |
nextEl: '.swiper-button-next', | |
prevEl: '.swiper-button-prev', | |
}, | |
/* | |
pagination: { | |
el: '.custom-swiper .swiper-pagination', | |
type: 'bullets', | |
clickable: true, | |
}, | |
*/ | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment