Skip to content

Instantly share code, notes, and snippets.

@nkpznkpz
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save nkpznkpz/764f15144b35056d4787 to your computer and use it in GitHub Desktop.

Select an option

Save nkpznkpz/764f15144b35056d4787 to your computer and use it in GitHub Desktop.
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
@nkpznkpz

Copy link
Copy Markdown
Author

But it is not fun anymore. 555

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment