Reply
Onmouseover div swap gives flickering effect
Old 01-18-2008, 02:28 PM Onmouseover div swap gives flickering effect
Junior Talker

Posts: 2
I want to replace a div onmouseover by another div. The replacement takes place, but the div is flickering onmouseover. Why is that and how should I change my source code?

The jscript:
Code:
 
<script type="text/javascript" language="JavaScript"><!--
function HideDIV(d) { document.getElementById(d).style.display = "none"; }
function DisplayDIV(d) { document.getElementById(d).style.display = "block"; }
//--></script>
The divs:
Code:
 
<div class="menuiteminactief" id="contactout" onmouseover="HideDIV('contactout');DisplayDIV('contact')"><a href="contact.html" class="menu1">Contact</a></div>
<div class="menuitemactief" id="contact" style="display:none;" onmouseout="HideDIV('contact');DisplayDIV('contactout')">
<a href="contact.html" class="menu1" onmouseover="changeBg('contact','2')" onmouseout="changeBg('contact','1')">Contact</a><br>
<a href="contact.html" class="menu2" onmouseover="changeBg('contact','3')" onmouseout="changeBg('contact','1')">Verslagen</a><br>
<a href="contact.html" class="menu2" onmouseover="changeBg('contact','4')" onmouseout="changeBg('contact','1')">Lid worden</a><br>
<a href="contact.html" class="menu2" onmouseover="changeBg('contact','5')" onmouseout="changeBg('contact','1')">Andere vraag</a>
</div>
The complete code:
http://www.zuidamerika.net/ftcw2008/index_menutest.html
JanDeGroot is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 01-18-2008, 03:18 PM Re: Onmouseover div swap gives flickering effect
chrishirst's Avatar
Super Moderator

Posts: 13,486
Location: Blackpool. UK
change class names instead of backgrounds.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-19-2008, 03:33 PM Re: Onmouseover div swap gives flickering effect
Junior Talker

Posts: 2
I'm sorry, does'nt work. I removed the 'change-background' script but the flickering effect is still there.

Code:
 
<a href="contact.html" class="menu1">Contact</a><br>
<a href="contact.html" class="menu2">Verslagen</a><br>
<a href="contact.html" class="menu2">Lid worden</a><br>
<a href="contact.html" class="menu2">Andere vraag</a>
The complete code:
http://www.zuidamerika.net/ftcw2008/index_menutest.html
JanDeGroot is offline
Reply With Quote
View Public Profile
 
Old 01-19-2008, 09:22 PM Re: Onmouseover div swap gives flickering effect
svirid's Avatar
Experienced Talker

Posts: 34
Name: Dima
Location: Toronto, Canada
I am a little confused here what are u trying to do but I think the problem is with your 'A' DOM elements inside the DIV.
What hapends is that u have mouseout event on your DIV and when u mouse over on A element mouseout fires on DIV even that A tag located inside the DIV.

The easies way what u can do is to define event for the A tag on mouseover and cacel all of the following events.

set <a mosuseover="test(event)">Contact</a>

test = function(event) {
if(event.preventDefault)
event.preventDefault();
else
event.returnValue = false;
}
svirid is offline
Reply With Quote
View Public Profile Visit svirid's homepage!
 
Reply     « Reply to Onmouseover div swap gives flickering effect
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12258 seconds with 12 queries