Created
February 2, 2011 01:29
-
-
Save jthacker/807086 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
function f() { | |
i=0; | |
d=['n','s']; | |
// Call the first argument at an interval of 150ms | |
setInterval(function() { | |
$('.eye').each(function() { // Find all elements with a class of eye | |
// for each element change the src attribute to either the North or South image | |
// img_base is defined in the lateral-eye.js file from the webpage | |
$(this).attr('src',img_base+$(this).attr('rel')+'_'+d[i]+'.jpg') | |
}); | |
// Toggles the image between n and s | |
// i = 0 to start | |
// (0 + 1) mod 2 == 1 | |
// (1 + 1) mod 2 == 0 | |
i = (i+1) % d.length; | |
},150); | |
} | |
f() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment