Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

jquery - :hover issue when mouse moves over an iframe which is inside the div | Internet Explorer

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/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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;}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...