title: Opening an existing jQuery lightbox gallery from a link
body: <p>I have an existing jQuery colorbox gallery that works fine when I click any of the 4 images which is initialized on document ready with:</p>
  
  <pre><code>$(document).ready(function () {
      if ($('.gallery-thumbnail').length &gt; 0) {
          $('.gallery-thumbnail').colorbox({ rel: 'gallery-thumbnail', transition: 'fade' });
      }
  });
  </code></pre>
  
  <p>I also have a link in the page, which I would like to also open this same gallery of images.  I thought I would be cute and try to just replicate a user clicking one of the images with <code>$('.gallery-image').first().find('a').click();</code> which works perfectly and opens the image gallery when I type it in the Chrome Inline Console and hit <code>Enter</code>, but when it is run from the code, it just pops the gallery open with the orange loading GIF which spins endlessly.  After that I tried having an <code>onclick</code> handler directly on the HTML anchor which had the code <code>$('.gallery-thumbnail').colorbox({rel: 'gallery-thumb', transition: 'fade' });</code> which resulted in the same endless loading GIF as before.  To ensure that I wasn't going crazy, I hooked the <code>OnClick</code> event handler to a function which runs this code:</p>
  
  <pre><code>function showColorbox() {
      $('.gallery-thumbnail').each(function () {
          $(this).addClass('test');
      });
      $('.test').colorbox({rel: 'gallery-thumb', transition: 'fade' });
  }
  </code></pre>
  
  <p>Unfortunately, I still end up with the endless loading colorbox, but I verified that my image anchors all had the class 'test'.  Throughout this whole thing - I have also verified that there are no JS errors in the console.  Any help would be greatly appreciated.</p>