2 Replies - 3315 Views - Last Post: 05 March 2010 - 01:02 PM

#1 musya  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 11
  • View blog
  • Posts: 1,012
  • Joined: 25-April 07

hide div when mouse not over

Posted 01 March 2010 - 01:01 PM

<script type="text/javascript">
var opacitylevel = .0;
var opacitylevelIE = 00;
var opacitylevel_out = 1;
var opacitylevelIE_out = 100;
var close = false;
function mostReqInRecursive()
{
	if(close)
	{
		document.getElementById("mod_mostrequested").style.display = "none";
		close = false;
	} 
	else 
	{
		document.getElementById("mod_mostrequested").style.filter="alpha(opacity="+opacitylevelIE+");";
		document.getElementById("mod_mostrequested").style.opacity=opacitylevel;
		document.getElementById("mod_mostrequested").style.display = "block";
		
		if(opacitylevelIE != 100)
		{
			document.getElementById("mod_mostrequested").style.filter="alpha(opacity="+opacitylevelIE+")";
			document.getElementById("mod_mostrequested").style.opacity=opacitylevel;
			
			opacitylevel += .05;
			opacitylevelIE += 5;
			window.setTimeout('mostReqInRecursive()',<?=$params->get('mostreq_speed','')?>);	
		} else {
			close = true;
			return;
		}
	}
}

function mostReqIn()
{
	opacitylevel = .0;
	opacitylevelIE = 00;
	mostReqInRecursive();
	
}

<?
echo '<div id="mod_mostrequested" class="mod_mostrequested" style="display:none;">';
echo '<img align="right" src="/modules/mod_mostrequested/images/close.png" border=0 onclick="mostReqIn();"/>';

echo '<div style="float:left;text-align:left;min-width:150px;">';
echo '</div>';
echo '<div style="float:left;text-align:left;min-width:150px;padding-left:10px;">';
echo '</div>';

echo '</div>';
?>



Okay first things first, theirs the code (the gist of it at least). Now this code works fine, it fades in a div with some links in it (i skipped the part where the links are generated). What i want to be able to do its so that when your mouse leaves the div area, it will disappear, I cant figure out how to determine if your mouse is over the div or not, the rest i can handle probably, does anybody know of an effective way to determine if your mouse is over that div, or better yet if its not over it?

thank you,
musya

This post has been edited by musya: 01 March 2010 - 01:04 PM


Is This A Good Question/Topic? 0
  • +

Replies To: hide div when mouse not over

#2 bstonehill  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 113
  • Joined: 21-January 08

Re: hide div when mouse not over

Posted 04 March 2010 - 07:53 AM

You should be able to use a standard onmouseout event, but you will need to be mindful of event bubbling.

Check out this article for more information on bubbling:
http://www.quirksmod...ents_order.html
Was This Post Helpful? 0
  • +
  • -

#3 musya  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 11
  • View blog
  • Posts: 1,012
  • Joined: 25-April 07

Re: hide div when mouse not over

Posted 05 March 2010 - 01:02 PM

thank you, i dont know how i missed that one.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1