Last active
August 29, 2015 14:17
-
-
Save nkpznkpz/764f15144b35056d4787 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
var nextzy = {}; | |
nextzy.checkAns = function(el) { | |
for (var i = 0; i < el.length - 1; i++) { | |
if ($((el)[i]).css("background-color") == $((el)[i + 1]).css( | |
"background-color")) { | |
nextzy.tmp = $((el)[i]); | |
} else {// if index 1 == index 2 diff is index 0 | |
if (i == 0 && $((el)[i + 1]).css("background-color") == $((el)[i + 2]).css("background-color")) { | |
$((el)[0]).fadeOut(300, function() {$(this).click()}); | |
break; | |
} else { | |
$((el)[i + 1]).fadeOut(300, function() {$(this).click() }); | |
break; | |
} | |
} | |
} | |
}; | |
(function theLoop(i) { | |
setTimeout(function() { | |
if (--i) { // If i > 0, keep going | |
nextzy.checkAns($("#box > span").get()); | |
theLoop(i); // Call the loop again, and pass it the current value of i | |
} | |
}, 300);//delay | |
})(500);//loop number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
But it is not fun anymore. 555