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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.