<div id="slider" class="owl-carousel"> <div class="item"><img src="http://placehold.it/350x150&text=1" /></div> <div class="item"><img src="http://placehold.it/350x150&text=2" /></div> <div class="item"><img src="http://placehold.it/350x150&text=3" /></div> <div class="item"><img src="http://placehold.it/350x150&text=4" /></div> <div class="item"><img src="http://placehold.it/350x150&text=5" /></div> <div class="item"><img src="http://placehold.it/350x150&text=6" /></div> <div class="item"><img src="http://placehold.it/350x150&text=7" /></div> <div class="item"><img src="http://placehold.it/350x150&text=8" /></div> </div> <div id="thumbnails" class="owl-carousel"> <div class="item"><img src="http://placehold.it/80x80&text=1" /></div> <div class="item"><img src="http://placehold.it/80x80&text=2" /></div> <div class="item"><img src="http://placehold.it/80x80&text=3" /></div> <div class="item"><img src="http://placehold.it/80x80&text=4" /></div> <div class="item"><img src="http://placehold.it/80x80&text=5" /></div> <div class="item"><img src="http://placehold.it/80x80&text=6" /></div> <div class="item"><img src="http://placehold.it/80x80&text=7" /></div> <div class="item"><img src="http://placehold.it/80x80&text=8" /></div> </div>
var sync1 = $("#slider"); var sync2 = $("#thumbnails"); var flag = false; var slides = sync1.owlCarousel({ margin: 10, items: 1, nav:true }).on('change.owl.carousel', function(e) { if (e.namespace && e.property.name === 'position' && !flag) { flag = true; thumbs.to(e.relatedTarget.relative(e.property.value), 300, true); flag = false; } }).data('owl.carousel'); var thumbs = sync2.owlCarousel({ items:4, nav:false }).on('click', '.item', function(e) { e.preventDefault(); sync1.trigger('to.owl.carousel', [$(e.target).parents('.owl-item').index(), 300, true]); }).on('change.owl.carousel', function(e) { if (e.namespace && e.property.name === 'position' && !flag) { //nsole.log('...'); } }).data('owl.carousel');
Show more…
Hi Anish. Thanks for the demo, can we have some way to apply active class for current item on thumbnails
Hi thanks for the support.. pls use this one..becoz it is updated.. http://codehints.in/sync-two-owlcarousel-using-version-2-updated/. Also i will try to add class on the current item..