Skip to content

Instantly share code, notes, and snippets.

@rareyman
Created October 11, 2012 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rareyman/3875762 to your computer and use it in GitHub Desktop.
Save rareyman/3875762 to your computer and use it in GitHub Desktop.
bxslider
//$('#slider1').bxSlider();
// assign the slider to a variable
var slider = $('#slider1').bxSlider({
controls: false
});
// assign a click event to the external thumbnails
$('.thumbs a').click(function(){
var thumbIndex = $('.thumbs a').index(this);
// call the "goToSlide" public function
slider.goToSlide(thumbIndex);
// remove all active classes
$('.thumbs a').removeClass('pager-active');
// assisgn "pager-active" to clicked thumb
$(this).addClass('pager-active');
// very important! you must kill the links default behavior
return false;
});
// assign "pager-active" class to the first thumb
$('.thumbs a:first').addClass('pager-active');
// $('#slider2').bxSlider();
// assign the slider to a variable
var slider2 = $('#slider2').bxSlider({
controls: false
});
// assign a click event to the external thumbnails
$('.thumbs2 a').click(function(){
var thumbIndex = $('.thumbs2 a').index(this);
// call the "goToSlide" public function
slider2.goToSlide(thumbIndex);
// remove all active classes
$('.thumbs2 a').removeClass('pager-active');
// assisgn "pager-active" to clicked thumb
$(this).addClass('pager-active');
// very important! you must kill the links default behavior
return false;
});
// assign "pager-active" class to the first thumb
$('.thumbs2 a:first').addClass('pager-active');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment