Created
April 3, 2012 15:27
-
-
Save mente/2292914 to your computer and use it in GitHub Desktop.
This file contains 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
diff --git a/cloud-carousel.1.0.5.js b/cloud-carousel.1.0.5.js | |
index b6fc6a9..2e7bdf6 100644 | |
--- a/cloud-carousel.1.0.5.js | |
+++ b/cloud-carousel.1.0.5.js | |
@@ -147,19 +147,22 @@ | |
clearTimeout(event.data.showFrontTextTimer); | |
$(options.altBox).html( ($(event.target).attr('alt') )); | |
$(options.titleBox).html( ($(event.target).attr('title') )); | |
- if ( options.bringToFront && event.type == 'click' ) | |
- { | |
- | |
- var idx = $(event.target).data('itemIndex'); | |
- var frontIndex = event.data.frontIndex; | |
- //var diff = idx - frontIndex; | |
- var diff = (idx - frontIndex) % images.length; | |
- if (Math.abs(diff) > images.length / 2) { | |
- diff += (diff > 0 ? -images.length : images.length); | |
- } | |
- | |
- event.data.rotate(-diff); | |
+ } | |
+ if ( options.bringToFront && event.type == 'click' ) | |
+ { | |
+ | |
+ var idx = $(event.target).data('itemIndex'); | |
+ if (idx == undefined) { | |
+ return; | |
+ } | |
+ var frontIndex = event.data.frontIndex; | |
+ //var diff = idx - frontIndex; | |
+ var diff = (idx - frontIndex) % images.length; | |
+ if (Math.abs(diff) > images.length / 2) { | |
+ diff += (diff > 0 ? -images.length : images.length); | |
} | |
+ | |
+ event.data.rotate(-diff); | |
} | |
}); | |
// If we have moved out of a carousel item (or the container itself), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment