WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Fancybox with wordpress' built in gallery to display the images on my site. This is working great. However - due to the layout of my site, it's not very clear that the one image displayed is a gallery. To make it clear I want to put a 'open gallery' link beside the image. For example -

enter image description here

My question is - is it possible to open the gallery through a link, not a thumbnail? This is the code I have been playing around with -

HTML

[gallery link="file" columns="4" ids="174,175,176,173"]
<h2><a href="javascript:;" id="launcher">open gallery</a></h2>

JS

$("#launcher").on("click", function(){
$(".fancybox").eq(0).trigger("click");
});

Here is my site

share|improve this question
    
Try this js: $("#launcher").on("click", function(){ $(a[rel='gallery']).click(); }); – ssergei Jun 27 '14 at 20:20
    
doesn't work, ahh – Social Monster Jun 27 '14 at 21:14
    
Just noticed I missed the quotes on it: $("#launcher").on("click", function(){ $("a[rel='gallery']").click(); }); – ssergei Jun 27 '14 at 21:52
    
I tried that too, no go :-/ – Social Monster Jun 27 '14 at 22:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.