Jump to content

Onmouseover/Hover not working for IE 9


drayarms

Recommended Posts

Good day folks. Yes I know it all sounds too familiar.  I just started working with jQuery and up to this moment, thought it was the magic bullet to solving most cross browser issues. Well while working on this page, I realized to my horror that  onmouseover  wouldn't work with IE .  After doing some online searches, I learned that the hover function does work with IE but even after trying that too, Microsoft's browser still wouldn't implement this fine piece of programming genius.  Well what Im trying to do is simply increase the opacity of an element from 0 to 1 (ie make it transparent) when the mouse is rolled over it, and take it back to 0 when the mouse is removed.  The element has the class name "menu_decor" and here is the code i did to achieve this.  I will just include the hover function in the head section and the onmousover as an  inline call (doing it either way works).  To keep it simple, I would exclude the css sheet, but the defualt value for the element is set to 0 according to the css, so that when the page is loaded, it appears transparent.

 


<html xmlns="http://www.w3.org/1999/xhtml"> 

<head> 

	<script type = "text/javascript" src="http://code.jquery.com/jquery-latest.js">
	</script>


	<script type='text/javascript'>
		$(document).ready(function(){
		$(".menu_decor").hover(function() {
		$(this).css("opacity","1.0");
			}, function() {
		$(this).css("opacity","0");
		});
		});
	</script>


</head>


<body > 

                <td > <a href ="" > <div class = "menu_decor" onmouseover = "$(this).css('opacity','1.0');" onmouseout = "$(this).css('opacity','0');"> </div> </a> </td> 

       </body>


</html>


 

 

So my question is, how can this be made to work with IE if at all?  Thanks for any suggestions.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.