title: jquery fancybox iframe change the href value dynamically
body: <p>I have a button that I click and I want the fancybox to load whatever content is needed depending on some checkboxes that I can check. Those checkboxes will alter the value of the url that needs to be displayed in the iframe within the fancybox.</p>
  
  <p>So far I can get it to work once, when I change again the checkboxes I will see the url change on the html but the fancybox won't pop at all. </p>
  
  <p>Here is my button and the link for the fancybox:</p>
  
  <pre><code>&lt;button type="button" title="Compare" class="button"&gt;Compare&lt;/button&gt;
  &lt;a class="comparefancy" style="display:none;" href="#"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>Here is what happens when I click the button:</p>
  
  <pre><code>jQuery(document).ready(function() {
          jQuery('.button').click(function(){
  
              var i=0;
              var prdString="";
  
              var prdString = jQuery.map(jQuery(':checkbox:checked'), function(n, i){
                    return n.value;
              }).join(',');
  
              var url='&lt;?php echo Mage::getUrl('catalog/product_compare/index').'items/'; ?&gt;'+ prdString + '/uenc/';
  
              jQuery('.comparefancy').attr('href', url);//this works all the time
              jQuery('.comparefancy').fancybox();  //this will only work the first time
              jQuery('.comparefancy').trigger('click');
  
  
  
      });
  
  });
  </code></pre>
  
  <p>I've tried the beforeLoad method hinted at on some similar answers but it didn't work for me. </p>
  
  <p>Edit: After testing this more I removed the display none from the link and made it visible and then did the following: </p>
  
  <ol>
  <li>checked my checkboxes then clicked the button: the first fancybox loads just fine</li>
  <li>checked other checkboxes, then clicked the button: the link will change its href but the fancy won't load.</li>
  <li>click the link manually and then the fancybox loads the new url</li>
  </ol>
  
  <p>So the problem is my trigger click function then? wtf?</p>