Note that there are some explanatory texts on larger screens.

plurals
  1. POJs show and hide function
    primarykey
    data
    text
    <p>I know that out there are lots of scripts to show and hide content but none of them work for me when it comes to my scenario. Here on this test page <a href="http://bloghutsbeta.blogspot.com/2012/04/testing-game-content-issue.html" rel="nofollow">http://bloghutsbeta.blogspot.com/2012/04/testing-game-content-issue.html</a> I have flash game in iframe, IF you click on PLAY button or you don't click still the flash content starts loading in Chrome and IE (not in firefox).</p> <p>So to deal with this situation I thought of using show and hide content method and used a few scripts but none of them helped as even though when I was using them the flash content still use to load at the back end in IE and Chrome. What I am asking for is a script that won't let the flash content load until an 'onclick' function is performed. I know one script that do this 'LazyLoad' But it is for images, I don't think it will work for flash content too.</p> <p>Note: 1-There is Music on the link provided 2- Sorry for providing blogspot link but JsFiddle is not an option for a person living in Afghanistan with 5KBps.</p> <p>Relevant Markup: Button for lightbox or Modal Window</p> <pre><code>&lt;a class="poplight" href="#?w=100%" rel="popup_name"&gt;&lt;img alt="play game" class="happybutton" onmouseout="this.style.opacity=0.8;this.filters.alpha.opacity=80" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100" src="http://farm5.static.flickr.com/4084/4998558471_27e3985c16_m.jpg" style="opacity: 0.8;" /&gt;&lt;/a&gt; </code></pre> <p>Content set to be display none until the above button is clicked (this actually doesn't work in IE and Chrome ONLY in firefox)</p> <pre><code>&lt;div class="popup_block" id="popup_name"&gt; &lt;iframe width="100%" height="98%" src="http://files.cryoffalcon.com/bhgames/dressup/Celebrities/Wizard%20Fashion.html" frameborder="0" scrolling="no" allowTransparency="false" &gt;&lt;/iframe&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>#fade { display: none; background: #000; position: fixed; left: 0; top: 0; width: 100%; height: 100%; opacity: .80; z-index: 9999999; } .popup_block{ width: 98.95%; height: 98.2%; display: none; padding: 0px; line-height:1em; font-size: 1em; position: fixed; top: 0px; left: 0px; z-index: 999999999; -webkit-box-shadow: 0px 0px 20px #000; -moz-box-shadow: 0px 0px 20px #000; box-shadow: 0px 0px 20px #000; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; } .close { height:20px; float: right; margin: 0 2px 0 0; } </code></pre> <p>JS (actually Jquery)</p> <pre><code>&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt; $(document).ready(function(){ //When you click on a link with class of poplight and the href starts with a # $(&amp;#39;a.poplight[href^=#]&amp;#39;).click(function() { var popID = $(this).attr(&amp;#39;rel&amp;#39;); //Get Popup Name var popURL = $(this).attr(&amp;#39;href&amp;#39;); //Get Popup href to define size //Pull Query &amp;amp; Variables from href URL var query= popURL.split(&amp;#39;?&amp;#39;); var dim= query[1].split(&amp;#39;&amp;amp;&amp;#39;); var popWidth = dim[0].split(&amp;#39;=&amp;#39;)[1]; //Gets the first query string value //Fade in the Popup and add close button $(&amp;#39;#&amp;#39; + popID).fadeIn().css({ &amp;#39;width&amp;#39;: Number( popWidth ) }).prepend(&amp;#39;&amp;lt;a href=&amp;quot;#&amp;quot; title=&amp;quot;Close It&amp;quot; class=&amp;quot;close&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;http://files.cryoffalcon.com/bloghuts/images/close%20button.png&amp;quot; alt=&amp;quot;Close&amp;quot; width=&amp;quot;20&amp;quot; height=&amp;quot;20&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;#39;); //Define margin for center alignment (vertical + horizontal) - we add 80 to the height/width to accomodate for the padding + border width defined in the css var popMargTop = ($(&amp;#39;#&amp;#39; + popID).height() + 0) / 0; var popMargLeft = ($(&amp;#39;#&amp;#39; + popID).width() + 0) / 0; //Apply Margin to Popup $(&amp;#39;#&amp;#39; + popID).css({ &amp;#39;margin-top&amp;#39; : -popMargTop, &amp;#39;margin-left&amp;#39; : -popMargLeft }); //Fade in Background $(&amp;#39;body&amp;#39;).append(&amp;#39;&amp;lt;div id=&amp;quot;fade&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#39;); //Add the fade layer to bottom of the body tag. $(&amp;#39;#fade&amp;#39;).css({&amp;#39;filter&amp;#39; : &amp;#39;alpha(opacity=80)&amp;#39;}).fadeIn(); //Fade in the fade layer return false; }); //Close Popups and Fade Layer $(&amp;#39;a.close, #fade&amp;#39;).live(&amp;#39;click&amp;#39;, function() { //When clicking on the close or fade layer... $(&amp;#39;#fade , .popup_block&amp;#39;).fadeOut(function() { $(&amp;#39;#fade, a.close&amp;#39;).remove(); }); //fade them both out return false; }); }); &amp;lt;/script&amp;gt; </code></pre>
    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.
 

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