Jump to content

Recommended Posts

Is there a way to fade out this bit off code after 15 seconds?

 

<table width='95%' border='1' align='center' cellpadding='5' cellspacing='0'>
              <tr>
                <td bordercolor='#317082' bgcolor='#FFFFB7' class='adminResponse' align='center'>$response</td>
              </tr>
            </table><br>

 

Is it just a box which has some text in but after 15 seconds i want it to fade away any way off doing this?

Link to comment
https://forums.phpfreaks.com/topic/183657-any-way-to-fade-out-box-after-x-seconds/
Share on other sites

Yes.  What you want to do is change the opacity of the element using css or microsoft IE specific filters.  The code is quite complicated however, and you can find pre-canned effects in most of the various javascript libraries.  There's no particular magic to it -- you simply need to have a fadeout() function that increases the opacity of a css style until it reaches 100.

 

There's an excellent article with several examples and the nuts and bolts of this here ->  http://www.itnewb.com/v/Cross-Browser-CSS-Opacity-and-the-JavaScript-Fade-Fading-Effect

Download this:

http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js

 

Then use this code:

<script type="text/javascript" src="jquery-1.3.2.js"></script>
<div id="fadeout">Hello World</div>

<script>
    window.setTimeout(function() {
        $('#fadeout').hide(2000);
    }, 15000);
</script>

Download this:

http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js

 

Then use this code:

<script type="text/javascript" src="jquery-1.3.2.js"></script>
<div id="fadeout">Hello World</div>

<script>
    window.setTimeout(function() {
        $('#fadeout').hide(2000);
    }, 15000);
</script>

 

That wont work unless you place it in a jquery object.

 

<script>
$(document).ready(function(){
    window.setTimeout(function() {
        $('#fadeout').hide(2000);
    }, 15000);
});
</script>

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.