Skip to content

Instantly share code, notes, and snippets.

@overwine
Created June 1, 2012 15:24
Show Gist options
  • Save overwine/2852938 to your computer and use it in GitHub Desktop.
Save overwine/2852938 to your computer and use it in GitHub Desktop.
I'm a damn nub.
$('.checkbox').click(function(e){
if ($('.sprite-checked').length > 3) {
$("#compare-slide").slideUp(400);
return false;
}
if ($(this).hasClass('sprite-unchecked')) {
if ($('.sprite-checked').length > 1) {
$('.sprite-checked').get();
var checkList= new Array;
var i=$('.sprite-checked').length;
while (i>0) {
if ($(this).parents('.item').hasClass('segment') && $(this).parents('.item').hasClass('pillar')) {
checkList.push("pillar");
}
if ($(this).parents('.item').hasClass('characteristic')) {
checkList.push("characteristic");
}
if ($(this).parents('.item').hasClass('segment')) {
checkList.push("segment");
}
i--;
}
if (checkList[0] != checkList[1]) {
return false;
}
if (checkList[2] && checkList[0] != checkList[2]){
return false;
}
else {
$(this).removeClass('sprite-unchecked');
$(this).addClass('sprite-checked');
}
}
if ($('.sprite-checked').length < 1) {
$(this).removeClass('sprite-unchecked');
$(this).addClass('sprite-checked');
}
} else {
$(this).removeClass('sprite-checked');
$(this).addClass('sprite-unchecked');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment