Created
January 14, 2016 15:18
-
-
Save asharirfan/4f22ac5f739931f45480 to your computer and use it in GitHub Desktop.
Owl Carousel 2 (Custom function: triggering actions on base of slide number)
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 for triggering different events | |
* on base of slide number in | |
* Owl Carousel 2 | |
* @url (http://www.owlcarousel.owlgraphic.com/) | |
*/ | |
vr_slider_detailsPage.on('change.owl.carousel', function(event) { | |
//console.log(event.item.index); | |
var vr_slide_index = event.item.index; | |
if ( vr_slide_index == 2 ) { | |
$('.vr_carousel__pagDiv > div').removeClass('vr_carousel__currentSlide'); | |
$('.vr_carousel__pagDiv:nth-child(2) > div').addClass('vr_carousel__currentSlide'); | |
} | |
if ( vr_slide_index == 3 ) { | |
$('.vr_carousel__pagDiv > div').removeClass('vr_carousel__currentSlide'); | |
$('.vr_carousel__pagDiv:nth-child(3) > div').addClass('vr_carousel__currentSlide'); | |
} | |
if ( vr_slide_index == 4 ) { | |
$('.vr_carousel__pagDiv > div').removeClass('vr_carousel__currentSlide'); | |
$('.vr_carousel__pagDiv:nth-child(1) > div').addClass('vr_carousel__currentSlide'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment