Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-26-2012, 01:10 PM   PM User | #1
UD2006
Regular Coder

 
Join Date: Jul 2007
Location: Velsen Noord, Netherlands
Posts: 206
Thanks: 6
Thanked 0 Times in 0 Posts
UD2006 is an unknown quantity at this point
on mouseover show transparent div over hovered div

I am creating a page on which I have several div's. They contain an image as background.
When I do a mouseover on a div, I want a div (with an image semitransparant), to be placed ontop of it's hovered div. When mouseout the semitransparant div should be hidden.

Now I have the following code, it does work, but sometimes on mouseout the semitransparant div isn't hidden (when the mouse moves to quick). Is there a solution for it?

PHP Code:
echo '<div id="block-'.$BlockNums.'" class="blok '.$BlockStyle.'" onmouseover="document.getElementById(\'message\').style.display=\'block\';" ><img src="images/'.$BlockImg.'.png" width="181"/></div>';
echo 
'<a href="'.$BlockLink.'" style="display:block;cursor:pointer;"><div id="message" class="disMessage" style="display:none;" onmouseout="document.getElementById(\'message\').style.display=\'none\';"><p>'.$BlockMouse.'</p></div></a>'
And the css:
Code:
.disMessage
{
	width: 163px;
	height: 168px;
	z-index: 1000;
	position: absolute;
	padding: 10px 10px 10px 10px;
	text-align: center;
	background-image: url("../images/hoverTrans.png");
}
.blok
{
	width: 181px;
	height: 186px;
	/*border: 1px solid #FE7701;*/
	background-image: url("../images/blok.png");
	padding: 1px 9px 9px 1px;
}
Thanks
UD2006 is offline   Reply With Quote
Old 03-27-2012, 07:08 AM   PM User | #2
UD2006
Regular Coder

 
Join Date: Jul 2007
Location: Velsen Noord, Netherlands
Posts: 206
Thanks: 6
Thanked 0 Times in 0 Posts
UD2006 is an unknown quantity at this point
No one an idea how to solve this?
UD2006 is offline   Reply With Quote
Old 03-27-2012, 07:17 AM   PM User | #3
Mishu
Banned

 
Join Date: Mar 2012
Posts: 306
Thanks: 1
Thanked 28 Times in 28 Posts
Mishu can only hope to improve
You could use css positioning to put the semi-transparent div on top of the other and then hide it initially. When the bottom div is hovered on, set the display style of the semi-tansparent div to block.
Mishu is offline   Reply With Quote
Old 03-27-2012, 07:23 AM   PM User | #4
UD2006
Regular Coder

 
Join Date: Jul 2007
Location: Velsen Noord, Netherlands
Posts: 206
Thanks: 6
Thanked 0 Times in 0 Posts
UD2006 is an unknown quantity at this point
Quote:
Originally Posted by Mishu View Post
You could use css positioning to put the semi-transparent div on top of the other and then hide it initially. When the bottom div is hovered on, set the display style of the semi-tansparent div to block.
If you look at the code (first code), you see it's already been done.

The only problem is that I use multiple 'parent' div's next to each other, so when I move the mouse over a parent the semi-transparent div is shown, but when I move the mouse further over the other div's the semi-transparent on the first parent remains, while it should be hidden (I no longer have my mouse hovering the first parent div).
UD2006 is offline   Reply With Quote
Old 03-27-2012, 07:33 AM   PM User | #5
Mishu
Banned

 
Join Date: Mar 2012
Posts: 306
Thanks: 1
Thanked 28 Times in 28 Posts
Mishu can only hope to improve
Quote:
Originally Posted by UD2006 View Post
If you look at the code (first code), you see it's already been done.
I didn't have time to go work out what the php code is creating. It's badly formatted in the post and contains inline styles. Why not post the html the code actually creates and that will be easier to see what you have there.
Mishu is offline   Reply With Quote
Old 03-27-2012, 09:04 AM   PM User | #6
UD2006
Regular Coder

 
Join Date: Jul 2007
Location: Velsen Noord, Netherlands
Posts: 206
Thanks: 6
Thanked 0 Times in 0 Posts
UD2006 is an unknown quantity at this point
Quote:
Originally Posted by Mishu View Post
I didn't have time to go work out what the php code is creating. It's badly formatted in the post and contains inline styles. Why not post the html the code actually creates and that will be easier to see what you have there.
Ok, so here the html:
Code:
<div id="block-1" class="blok LeftTop" onmouseover="document.getElementById('message').style.display='block';" ><img src="images/verhuisbedrijf.png" width="181"/></div>
<a href="verhuisbedrijf" style="display:block;cursor:pointer;">
<div id="message" class="disMessage" style="display:none;" onmouseout="document.getElementById('message').style.display='none';"><p>Testing</p></div></a>
<div id="block-2" class="blok CenterTop"><div class="blEmpty"></div></div>
<div id="block-3" class="blok RightTop"><div class="blEmpty"></div></div>
<div id="block-4" class="blok LeftCenter"><div class="blEmpty"></div></div>
<div id="block-5" class="blok CenterMid"><div class="blEmpty"></div></div>
<div id="block-6" class="blok RightCenter"><div class="blEmpty"></div></div>
<div id="block-7" class="blok LeftBottom"><div class="blEmpty"></div></div>
<div id="block-8" class="blok BottomCenter"><div class="blEmpty"></div>
</div><div id="block-9" class="blok RightBottom"><div class="blEmpty"></div></div>
Hope you can find something.
UD2006 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:03 PM.


Advertisement
Log in to turn off these ads.