:hover issue when mouse moves over an iframe which

2020-02-13 01:26发布

问题:

Here is my problem:

I have made a small bar in the left side of the browserwindow #blokje{left:-180px; position:absolute;...}, when users hover over the bar --> the position changes using #blokje:hover{left:0}; All this works fine, but now I've added a google adsense frame inside the div and... everything works fine except in IE (most used browser; ads...)

It looks like the div:hover disappears over the frame causing annoying flickering and users are unable to click ads !

I think that a possible solution would be to use jquery instead of css to perform the hover effect. Can someone translate my css for me to jQuery ?

#blokje{width:200px; height:200px; background:#F1F1F1; position:relative; left:-180px; color:black; }
#blokje:hover{left:0;}
#blokje #tit{position:absolute; width:30px; height:200px; background:black; right:0; top:0; }

fiddler explains the issue; please note that the problem is only in IE

http://jsfiddle.net/6FeH8/

The live example online in a test environment not cached (Note: it's about the bar in the left not the 404 error !)

http://kramels.x10.mx/goedkoopste-autolening.tk/

回答1:

The following should achieve the effect you want. This is based on the linked answer. jQuery:

    if($.browser.msie){
        $("#blokje iframe").on("hover",function(){ 
            $(this).parents("#blokje").toggleClass("hover");
        });
    }

CSS:

#blokje:hover,#blokje.hover{left:0;}