Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Actually, none of the solutions posted previously work in real life, why? because the line:</p> <pre><code>$("#various1").fancybox(); </code></pre> <p>doesn't trigger fancybox, it just binds fancybox to the selector #various1, but it still needs a click to trigger the modal/lightbox (not a popup). BTW, Gearóid's solution has syntax errors anyway. The only real value is that they suggest the use of the <a href="http://plugins.jquery.com/project/cookie" rel="noreferrer">jQuery cookie plugin</a> (old site).</p> <p><strong>EDIT</strong>: (March 07, 2012) The jQuery cookie plugin home page <a href="https://github.com/carhartl/jquery-cookie" rel="noreferrer">moved here</a>.</p> <p>Steps for a working solution:</p> <p>A) Load the jQuery cookie plugin (as suggested) after jQuery and fancybox js files</p> <p>B) Then use this script:</p> <pre><code>&lt;script type="text/javascript"&gt; function openFancybox() { setTimeout( function() {$('#various1').trigger('click'); },20000); } $(document).ready(function() { var visited = $.cookie('visited'); if (visited == 'yes') { return false; } else { openFancybox(); } $.cookie('visited', 'yes', { expires: 7 }); $('#various1').fancybox(); }); &lt;/script&gt; </code></pre> <p>C) you still need to have somewhere in your html code (maybe hidden)</p> <blockquote> <pre><code>&lt;a id="various1" href="path/target"&gt;&lt;/a&gt; </code></pre> </blockquote> <p>or for inline content</p> <pre><code>&lt;a id="various1" href="#target"&gt;&lt;/a&gt; &lt;div style="display: none;"&gt; &lt;div id="target"&gt;message to display in fancybox&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Also, if you use inline content and fancybox v1.3.x, check for an existing bug and workaround <a href="http://groups.google.com/group/fancybox/browse_thread/thread/fab7b6d81a173b33/" rel="noreferrer">here</a></p> <p>PS. fancybox is not a popup but a modal/lightbox jQuery plugin, which is a non-intrusive solution like jGrowl from a UI point of view.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload