XmisterIS
01-05-2012, 05:09 PM
I have a test peice of html is set up roughly like this:
<div id="bill" onmouseover="javascript: show('bob'); hide('bill');">
<h1>Bill says hi</h1>
</div>
<div id="bob" style="visibility:hidden; display:none;" onmouseout="javascript: show('bill'); hide('bob');">
<h1>Bob says hi</h1>
</div>
And my javascript looks like this:
function show(elemId) {
elem = document.getElementById(elemId);
elem.style.visibility = "visible";
elem.style.display = "block";
}
function hide(elemId) {
elem = document.getElementById(elemId);
elem.style.visibility = "hidden";
elem.style.display = "none";
}
You can see what it does from the code: When the page loads, it shows the text Bill says hi. When you move the mouse over the text, it changes to Bob says hi. When you move the mouse away from the text, it reverts to Bill says hi.
BUT - this only seems to work consistently when the mouse is moved away from the text at slow speed - if you pull the mouse away quickly, it sometimes gets stuck on Bob says hi.
Any ideas why? :confused::confused::confused:
<div id="bill" onmouseover="javascript: show('bob'); hide('bill');">
<h1>Bill says hi</h1>
</div>
<div id="bob" style="visibility:hidden; display:none;" onmouseout="javascript: show('bill'); hide('bob');">
<h1>Bob says hi</h1>
</div>
And my javascript looks like this:
function show(elemId) {
elem = document.getElementById(elemId);
elem.style.visibility = "visible";
elem.style.display = "block";
}
function hide(elemId) {
elem = document.getElementById(elemId);
elem.style.visibility = "hidden";
elem.style.display = "none";
}
You can see what it does from the code: When the page loads, it shows the text Bill says hi. When you move the mouse over the text, it changes to Bob says hi. When you move the mouse away from the text, it reverts to Bill says hi.
BUT - this only seems to work consistently when the mouse is moved away from the text at slow speed - if you pull the mouse away quickly, it sometimes gets stuck on Bob says hi.
Any ideas why? :confused::confused::confused: