webtekie
04-04-2003, 09:18 AM
Hi,
I need to delay when layer becomes visible, how do I accomplish this?
thanks,
Alex
I need to delay when layer becomes visible, how do I accomplish this?
thanks,
Alex
|
Click to See Complete Forum and Search --> : Delaying show of layer webtekie 04-04-2003, 09:18 AM Hi, I need to delay when layer becomes visible, how do I accomplish this? thanks, Alex gil davis 04-04-2003, 09:24 AM Use setTimeout():setTimeout("layerobj.style.visibilty='visible'", 1000); // 1000 = one second khalidali63 04-04-2003, 09:25 AM function showLayer(){ layer.style.visibility="visible"; } and where ever you want this to be called say from a link may be <a href="javascript:setTimeout('showLayer()',3000)">Show Layer</a> This will show the layer with 3 secs delay. Cheers Khalid webtekie 04-04-2003, 09:40 AM wow, that was fast reply. Thanks guys. Well, I tried it, but it does not work. Here is what I have: external file: -------------- isNS4 = (document.layers) ? true : false; isIE4 = (document.all && !document.getElementById) ? true : false; isIE5 = (document.all && document.getElementById) ? true : false; isNS6 = (!document.all && document.getElementById) ? true : false; function switchDiv(strDivName,bolVisible){ //identify the element based on browser type if(isNS4) { objElement = document.layers[strDivName]; } else if (isIE4) { objElement = document.all[strDivName]; } else if (isIE5 || isNS6) { objElement = document.getElementById(strDivName); } if(isNS4){ if(!bolVisible) { objElement.visibility ="hidden" }else{ objElement.visibility ="visible" } }else{ if(!bolVisible) { objElement.style.visibility = "hidden"; }else{ objElement.style.visibility = "visible"; } } } in HTML page: ---------------- <SCRIPT LANGUAGE="JavaScript1.2" SRC="DelayTicker.js" TYPE='text/javascript'></SCRIPT> <body onLoad="javascript:setTimeout('switchDiv('myDiv',true)',10000)"> <div id="myDiv" style="visibility:hidden;position:relative"> Test layer </div> What am I doing wrong here? thanks, webtekie khalidali63 04-04-2003, 09:44 AM try this line... <body onLoad="setTimeout('switchDiv(\'myDiv\',true)',10000)"> Cheers Khalid webtekie 04-04-2003, 09:50 AM Great! Thanks Khalid it works now... webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |