Created
May 24, 2015 18:27
-
-
Save brejoc/5d7c53812291063131bd to your computer and use it in GitHub Desktop.
FancyBox2 and Bootstrap Carousel - You spin me round!
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
| /* | |
| With this afterLoad callback, the bootstrap gallery | |
| switches pages with the current image displayed in | |
| the FancyBox modal. | |
| */ | |
| $(".fancybox").fancybox({ | |
| loop : false, | |
| afterLoad: function(current, previous) { | |
| if(previous) { | |
| var carouselItems = 6; | |
| if(current.index > previous.index && current.index % carouselItems == 0) { | |
| $('#myCarousel').carousel('next'); | |
| } else if(current.index < previous.index && previous.index % carouselItems == 0) { | |
| $('#myCarousel').carousel('prev'); | |
| } | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment