Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. $('#myCarousel').carousel({
  2. interval: 4000
  3. });
  4.  
  5. // handles the carousel thumbnails
  6. $('[id^=carousel-selector-]').click( function(){
  7. var id_selector = $(this).attr("id");
  8. var id = id_selector.substr(id_selector.length -1);
  9. id = parseInt(id);
  10. $('#myCarousel').carousel(id);
  11. $('[id^=carousel-selector-]').removeClass('selected');
  12. $(this).addClass('selected');
  13. });
  14.  
  15. // when the carousel slides, auto update
  16. $('#myCarousel').on('slid', function (e) {
  17. var id = $('.item.active').data('slide-number');
  18. id = parseInt(id);
  19. $('[id^=carousel-selector-]').removeClass('selected');
  20. $('[id=carousel-selector-'+id+']').addClass('selected');
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement