Created
November 13, 2010 21:28
-
-
Save dustinsenos/675668 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
/* Example 1 - Store as variable */ | |
var leftImg = $(images[0]); | |
var centerImg = $(images[1]); | |
var rightImg = $(images[2]); | |
leftImg.css('left', -leftImg.width() + X_OFFSET); | |
centerImg.css('left', ((windowWidth / 2) - (centerImg.width() / 2))); | |
rightImg.css('left', windowWidth - X_OFFSET); | |
/* Example 2 - Lookup */ | |
$(images[0]).css('left', -$(images[0]).width() + X_OFFSET); | |
$(images[1]).css('left', ((windowWidth / 2) - ($(images[1]).width() / 2))); | |
$(images[2]).css('left', windowWidth - X_OFFSET); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Makes sense, I think mixing the two too much could drive your code into some strange patterns with no good cause. I'm incredibly interested in the performance side of JS / jQuery so I appreciate your insight.