user3396867
user3396867

Reputation: 109

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();
});

Upvotes: 0

Views: 320

Answers (2)

nvuono
nvuono

Reputation: 3363

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.

Upvotes: 0

Blagoicho
Blagoicho

Reputation: 11

Put class of the links with lightbox...

Example:

<a href="img/1.jpg" class="nivolightbox">something</a>
<a href="img/2.jpg" class="nivolightbox">something</a>

and lightbox code

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

Upvotes: 1

Related Questions