I am using a lightbox triggered by many elements. I need to alter the style (light to dark) when one unique element is clicked so I added an id to that element. I then force the css default on each click of lightbox but added an override on the #saved id. I am still learning jquery. Assuming I may need to unload that first click function.
What happens is that if #saved is clicked it is always ignored however it works fine the second time forward. Even clicking from .lightbox to #saved elements back and forth triggers properly. Addditionally if a .lightbox element is clicked first, then #saved - #saved lunches with the correct css. In conclusion the only time this fails on the first click is if #saved is the first element with a class of .lightbox that is clicked.
HTML:
Typical
<a href="/" class="lightbox">click me</a>
Unique
<a href="/" class="lightbox" id="saved">click me too</a>
JavaScript:
$(document).ready(function() {
var cssLB='.jquery-lightbox-mode-html .jquery-lightbox-background,.jquery-lightbox-loading,.jquery-lightbox-mode-html .jquery-lightbox-loading';
$('.lightbox').lightbox().click(function(){$(cssLB).css('background','#FFF url(/inc/img/loading.gif) no-repeat center center;')});
$('#saved').click(function(){
$(cssLB).css('background','#000 url(/inc/img/loading-dark.gif)');
});