Jump to content

fadeout and hide div from iframe (without jquery)


Zombay

Recommended Posts

Why does this script need alert to work? I tested it in Firefox. :confused:

 

<script type="text/javascript">

function fadeOut(el, frame) {

alert("Why this does not work without this alert?");

var el = parent.frames[frame].document.getElementById(el);
var opacity = 1;

    (function(){
        if (opacity <= 0) { el.style.display='none'; return; }

        el.style.opacity = ( opacity -= 0.02);
        setTimeout(arguments.callee, 15);
    })();
}
</script>

 

 

<input type="submit" name="fade" value="Fade" onclick="fadeOut('fade_this','iframe');" />

<iframe src="iframe.html" height="400" name="iframe" id="iframe" frameborder="0"></iframe>

 

iframe.html:

<div id="fade_this">Fade this</div>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.