Last active
February 18, 2021 15:26
-
-
Save rhcarlosweb/0b0e5338a1c9a06276f5f1e3fc312a20 to your computer and use it in GitHub Desktop.
Owl Carousel 2 Sync Two Sliders
This file contains 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
var sync1 = $('#sync1'), | |
sync2 = $('#sync2'), | |
duration = 300, | |
thumbs = 4; | |
// Sync nav | |
sync1.on('click', '.owl-next', function () { | |
sync2.trigger('next.owl.carousel') | |
}); | |
sync1.on('click', '.owl-prev', function () { | |
sync2.trigger('prev.owl.carousel') | |
}); | |
// Start Carousel | |
sync1.owlCarousel({ | |
// rtl: true, | |
// center: true, | |
loop: true, | |
items: 1, | |
margin: 0, | |
smartSpeed: 700, | |
lazyLoad: true, | |
autoplay: true, | |
autoplayTimeout: 5000, | |
autoplayHoverPause: true, | |
nav: true, | |
navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'] | |
}).on('dragged.owl.carousel', function (e) { | |
if (e.relatedTarget.state.direction == 'left') { | |
sync2.trigger('next.owl.carousel') | |
} else { | |
sync2.trigger('prev.owl.carousel') | |
} | |
}); | |
sync2.owlCarousel({ | |
// rtl: true, | |
loop: true, | |
items: thumbs, | |
margin: 2, | |
autoplay: true, | |
autoplayTimeout: 5000, | |
autoplayHoverPause: true, | |
smartSpeed: 700, | |
nav: false, | |
// center: true, | |
responsive: { | |
0: { | |
items: 3 | |
}, | |
768: { | |
items: 4 | |
} | |
} | |
}).on('click', '.owl-item', function () { | |
var i = $(this).index() - (thumbs + 1); | |
sync2.trigger('to.owl.carousel', [i, duration, true]); | |
sync1.trigger('to.owl.carousel', [i, duration, true]); | |
}); |
This file contains 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
<div class="owl-carousel" id="sync1"> | |
Item | |
Item | |
</div> | |
<div class="owl-carousel" id="sync2"> | |
Item | |
Item | |
</div> |
Try this one https://codepen.io/aykutkapisiz/pen/POGJxg
Em qua, 29 de abr de 2020 07:36, zdimaz <notifications@github.com> escreveu:
… ***@***.**** commented on this gist.
------------------------------
Bugs syns!!!
If drag for more slides.....((((
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/0b0e5338a1c9a06276f5f1e3fc312a20#gistcomment-3274644>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABCS6Y33QQ7ZBM74WWRFZADRO77MFANCNFSM4MTTJNPQ>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bugs syns!!!
If drag for more slides.....((((