JackTheTripper
05-19-2003, 07:16 PM
Trying to set a time delay that works like this. You have 2 images. onMouseOver each image shows a different layer. OnMouseOut I want it to hide the layer after 10 seconds UNLESS image 2 is moused over. Then I want image 2's layer to show and to cancel the delay to make layer 1 hide. Make sense? I had it working but it was buggie in that if you moused over image 1 then out of image 1 and 5 seconds later moused over image 2, even though you don't mouse out of image 2 the image 2 layer would hide.
I didn't include the function for showing/hiding the layers as I didn't think it was important.
Thanks in advance for any help.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<script>
function resetLayers() {
MM_showHideLayers('layer1','','hide')
MM_showHideLayers('layer2','','hide')
}
function delayReset() {
for (i=0; i<10; i++) {
if (isOver == true) {
return
}
setTimeout('',1000)
}
resetLayers()
}
var isOver
</script>
<img src= "images/image1.gif" onMouseOver="isOver = true; resetLayers(); MM_showHideLayers('layer1','','show')" onMouseOut= "isOver = false; delayReset();">
<br><br>
<img src= "images/image2.gif" onMouseOver="isOver = true; resetLayers(); MM_showHideLayers('layer2','','show')" onMouseOut= "isOver = false; delayReset();">
<div id="layer1" style="position:absolute; left:172px; top:130px; width:259px; height:257px; z-index:1; visibility: hidden"> foo </div>
<div id="layer2" style="position:absolute; left:172px; top:130px; width:259px; height:257px; z-index:1; visibility: hidden"> foo also </div>
I didn't include the function for showing/hiding the layers as I didn't think it was important.
Thanks in advance for any help.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<script>
function resetLayers() {
MM_showHideLayers('layer1','','hide')
MM_showHideLayers('layer2','','hide')
}
function delayReset() {
for (i=0; i<10; i++) {
if (isOver == true) {
return
}
setTimeout('',1000)
}
resetLayers()
}
var isOver
</script>
<img src= "images/image1.gif" onMouseOver="isOver = true; resetLayers(); MM_showHideLayers('layer1','','show')" onMouseOut= "isOver = false; delayReset();">
<br><br>
<img src= "images/image2.gif" onMouseOver="isOver = true; resetLayers(); MM_showHideLayers('layer2','','show')" onMouseOut= "isOver = false; delayReset();">
<div id="layer1" style="position:absolute; left:172px; top:130px; width:259px; height:257px; z-index:1; visibility: hidden"> foo </div>
<div id="layer2" style="position:absolute; left:172px; top:130px; width:259px; height:257px; z-index:1; visibility: hidden"> foo also </div>