Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE7/8: div loses :hover if mouse moves over an iframe which is inside the div!

I'm trying to add facebook "like button" and twitter "tweet button" on a list, my list structure is:

<list>
    <listItem>
        <iframeContainer>
            <iframe/>
        </iframeContainer>
    </listitem>
</list>

css is:

listItem iframeContainer {display:none;}
listItem:hover iframeContainer {display:block;}

IE7/8: the problem is when mouse moves over the iframe the listItem loses its focus.

I tried to fix it by csshover.htc but it doesn't fix it.

It works fine in other browsers.

you can check it out live here:
http://bit.ly/hsFtq6
you need to signup at website, it's easy and fast :)

Thanks

like image 753
Behzad Avatar asked Dec 22 '10 08:12

Behzad


1 Answers

I've fixed it by the same way as csshover.htc though adding csshover.htc didn't fix it!

if($.browser.msie){
     $('.item').live('mouseenter',function() {
        $(this).addClass('hover');
     });
     $('.item iframe').live('hover',function() {
        $(this).parents(".item").addClass('hover');
     });
     $(".item").live('mouseleave',function() {
        $(this).removeClass('hover');
     });
}

css:

.item:hover, .item.hover {background-color:#555;}
like image 102
Behzad Avatar answered Nov 03 '22 00:11

Behzad