1

I have this code that doesn't work in IE8:

$("#intro-screenshot").hover(
   function(){
      $(".img-action").show();
   },
   function(){
      if(!$(".img-action").is(":hover")) {
         $(".img-action").hide();
      }
   }
);

It breaks on this line: if(!$(".img-action").is(":hover"))

HTML:

<a href="#">
   <img src="#" alt="" id="intro-screenshot" />
   <span class="img-action" style="top:90px; left:115px;">
   See Features
   </span>
</a>

I don't think this is a known Jquery problem but I might be wrong..

JSFIDDLE

3
  • What JQuery version are you using?
    – Greg
    Commented Apr 4, 2012 at 13:28
  • Can you make a jsfiddle? Commented Apr 4, 2012 at 13:33
  • Jquery 1.6.2 and jsfiddle above
    – greener
    Commented Apr 4, 2012 at 13:45

3 Answers 3

2

You could just use CSS. It handles the exact issue you're looking to solve, and more elegantly too.

#inner {
    display: none;
}

#outer:hover #inner {
    display: block;
}

jsFiddle: http://jsfiddle.net/7xMpr/

EDIT:

And a jsFiddle using your code http://jsfiddle.net/QeLSJ/1/

1

What if you try this:

$("#intro-screenshot").hover(
   function(){
      $(".img-action").show();
   },
   function(){
       if($(".img-action:hover").length == 0) {
         $(".img-action").hide();
      }
   }
);
0
try{
    jQuery('body').live('click', function(){
    var booleans=0; 
    try{
        booleans=jQuery("#loginForm:hover").length;
        //booleans=jQuery('#loginForm').is(':hover');
    }catch(e){}
    if(booleans==0){
        document.getElementById("d1").style.display = 'none';
    }
  });       
}catch(e){}

Not the answer you're looking for? Browse other questions tagged or ask your own question.