Ok, I have this code. I'm using a
Script.acul.ous library. (You can download the zip file and copy the "prototype.js" file from the "lib" folder and all the other files from the "src" folder into a "js" folder in your project.) To do a fade out effect on a <div> tag after a specified amount of time.
What happens is this:
On my internal network, the timer used works great!
On the outside - the <div> cuts out earlier than on the inside. I'm sure it's something simple that I'm overlooking... and it probably has to do with how fast the browser(s) load the pages.
This is the code I'm using (taking into consideration other browser types):
(please keep in mind that you need the other files from the above mentioned zip files in your "js" folder for them to be called on)
Code:
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js"></script>
<script type="text/javascript">
<!--
var browserName=navigator.appName;
if (browserName=="Microsoft Internet Explorer")
{
Event.observe(window, 'load', function() {
var fade=setTimeout("fadeout()", 41500);
var hide=setTimeout("$('DIVNAME').hide()", 42500);
});
function fadeout(){
new Effect.Opacity("DIVNAME", {duration:1.0, from:1.0, to:0.0});
}
}
else
{
Event.observe(window, 'load', function() {
var fade=setTimeout("fadeout()", 40400);
var hide=setTimeout("$('DIVNAME').hide()", 41500);
});
function fadeout(){
new Effect.Opacity("DIVNAME", {duration:1.0, from:1.0, to:0.0});
}
}
//-->
</script>
Like I said, internally, it works great in IE, FF, and Safari (for Windows). But outside the network, it's cutting out earlier than anticipated... any thoughts?
I can show you an example, but the site is for work and I would need strictest confidentiality on it (as it's not completely live, yet and is in stage to go live next week)... if you agree to that, I'll furnish you with the link (privately).