November 2, 2012

jQuery Multiple :not Selectors

I use jQuery on this site to fade in and out on link clicks, although there are some exceptions that I have to disable it for. It’s easy enough to do it for one selector, but if you need to add multiple selectors you need to append the :not after the last as follows.

jQuery('a:not([href^=mailto]):not(".bsub")').click(function() {
    var location = jQuery(this).attr('href');
    jQuery('#content').animate({
        opacity: 0
    }, 250);
    jQuery('.bounce').animate({
        left: -500
    }, 300, function() {
        document.location = location;
    });
    return false;
});

Leave a Reply

Your email address will not be published.

css.php