Created
February 3, 2012 15:34
-
-
Save mkorostoff/1730763 to your computer and use it in GitHub Desktop.
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
/* | |
Kid Rock Slide Show | |
By Matt Korostofff | |
February 1, 2012 | |
version 0.0.0.0.1 | |
*/ | |
var list_size; | |
var loop=0; | |
/* We fade in three slides at once. "next_up" describes the THIRD slide in a group. | |
So if we're about to fade in slides 1, 2, and 3 next_up=3. When the last slide | |
displayed on screen is slide 3, next_up=6, and so on. Since we start out displaying | |
the first three slides, we initialize this value as 6. */ | |
var next_up=6; | |
//Count the number of rows in the view. We use this to reset the counter and loop the slideshow | |
list_size=jQuery('.featured-slider li').size(); | |
function go_to_next_page() { | |
//We fade out everything, even if it's already hidden | |
jQuery('.featured-slider .views-row').fadeOut(1000); | |
//We fade in the next three slides with a loop | |
for (fade_me_in=next_up;fade_me_in>next_up-3;fade_me_in--) { | |
jQuery('.featured-slider .views-row-' + fade_me_in).fadeIn(1000); | |
} | |
//Once we've shown all the slides, we reset the counters | |
next_up=fade_me_in+6; | |
if (next_up>list_size+3) { | |
next_up=3; | |
} | |
} | |
function go_to_previous_page() { | |
jQuery('.featured-slider .views-row').fadeOut(1000); | |
for (fade_me_in=next_up;fade_me_in<next_up-3;fade_me_in--) { | |
jQuery('.featured-slider .views-row-' + fade_me_in).fadeIn(1000); | |
} | |
next_up=fade_me_in-6; | |
} | |
//Play the slideshow | |
//var interval_id = setInterval('go_to_next_page()',10000); | |
/*There's one particular row that overflows the container. On the EOS site it's hidden, so we'll copy that approach here. | |
There's no value to searching by row number, since that will change frequently in all likelihood. So we search for the | |
only static content, the innerHTML and hide its container */ | |
jQuery(".views-row .views-field-body-1:contains('More than anything, I'm delighted')").hide(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment