I am experiencing a bizarre issue with fancybox v2. I am using the following javascript code which once the “id=”close”” has been specified inside a fancybox instance it should close the lightbox. This works for the signin box only and not the contact for which is strange behavior. The javascript i am using is as follows…
$("#close").click(function(){
$.fancybox.close(true);
});
and the html to trigger this would be something along the lines of…
< span class=”button” id=”close”>Close< /span>
When you click the signin button, this functionality works as intended but when you attempt going to Support>Contact Us then it doesnt seem to be working and i cant seem to work out why.
Thanks for any advice given it means alot.
IDs should be unique in an HTML document. If you have multiple elements with ID “close”, you will see unexpected behaviour.
Classes can be applied to multiple elements, so you may wish to make the following changes. Update your Javascript like this:
and update your markup to remove the IDs and add a class: