jquerylightboxnivo-slider

Exclude a link from nivo lightbox


I am using nivo lightbox plugin. It is working good. But when I have added my youtube channel link to my social icons, it is also opening my channel link in the lightbox. How can I get rid of it?

Here is the nivo lightbox code I am using

$(document).ready(function(){
    $('a').nivoLightbox();
});

Solution

  • Based on your comment there may be an alternative to the accepted answer:

    There is a lot of links in my site. It will be hard to add a class in every link

    It may be easier for you to exclude your youtube link if there is a specific class associated with it like socialClass in the example below:

    <a href="http://youtube.com/yourchannel" class="socialClass">My Youtube Channel Link</a>
    

    You can use the jQuery .not() function to exclude the .socialClass links specifically:

    $(document).ready(function(){
        $('a').not('.socialClass').nivoLightbox();
    });
    

    I still recommend you go with the other answer to continue to decorate your lightbox links with an appropriate class=nivolightbox but you should also be aware of the .not() function and when/where to use it.