Orionsbelter Posted December 1, 2009 Share Posted December 1, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/183657-any-way-to-fade-out-box-after-x-seconds/ Share on other sites More sharing options...
gizmola Posted December 2, 2009 Share Posted December 2, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/183657-any-way-to-fade-out-box-after-x-seconds/#findComment-969480 Share on other sites More sharing options...
Tazz Posted December 3, 2009 Share Posted December 3, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/183657-any-way-to-fade-out-box-after-x-seconds/#findComment-970695 Share on other sites More sharing options...
YourNameHere Posted December 4, 2009 Share Posted December 4, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/183657-any-way-to-fade-out-box-after-x-seconds/#findComment-971078 Share on other sites More sharing options...
Tazz Posted December 4, 2009 Share Posted December 4, 2009 What do you mean YourNameHere? The fadeout is a jquery function therefore you need to include the jquery library. I have actually tested that code, it works just as it is there. Quote Link to comment https://forums.phpfreaks.com/topic/183657-any-way-to-fade-out-box-after-x-seconds/#findComment-971086 Share on other sites More sharing options...
YourNameHere Posted December 4, 2009 Share Posted December 4, 2009 Yes, you do have to include the library, I'm not arguing that. My code just waits for DOM readiness. Quote Link to comment https://forums.phpfreaks.com/topic/183657-any-way-to-fade-out-box-after-x-seconds/#findComment-971088 Share on other sites More sharing options...
Tazz Posted December 4, 2009 Share Posted December 4, 2009 YourNameHere, sure, makes sense. But it works without waiting for DOM readiness as well. I just tried it again. Quote Link to comment https://forums.phpfreaks.com/topic/183657-any-way-to-fade-out-box-after-x-seconds/#findComment-971091 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.