I might just blame this on lack of sleep, but I'm having a hell of a time removing a class from some links.
Here's what's happening: I'm adding a class to a bunch of links when I check a checkbox, and then I hope to remove remove the class by unchecking the checkbox.
Also involved: Changing a class on the checkbox, which does work when I uncheck it. It just doesn't also remove the classes.
$(document).ready(function() {
var revealer = $('.revealer .reveal');
var hider = $('.revealer .hide');
var days = $('.days li a');
var revealed = $('.days li a.revealed');
$(revealer).change(function() {
$(this).toggleClass('reveal hide');
$(days).each(function(i) {
var day = $(this);
setTimeout(function() {
// $(day).toggleClass('revealed'); Toggle would work, but I don't want the delay when removing the class
$(day).addClass('revealed');
}, 300 * i);
});
});
$(hider).change(function() {
$(this).toggleClass('reveal hide');
$(revealed).removeClass('revealed');
});
});
In the jsFiddle, each link's background fades to black, one at a time. That much works. Unchecking should fade them all back to normal at once, but it doesn't.