简体   繁体   English

将鼠标悬停在社交按钮上时,IE悬停功能不起作用

[英]IE hover function not working when hovering over social buttons

Noob here so bear with me please. Noob在这里,所以请和我一起。 There are a lot of examples like this but they do not make any sense to me. 有很多这样的例子,但对我来说它们没有任何意义。

I have this table with a like button on that pops out when you hover over it. 我有这张桌子,上面有一个喜欢的按钮,当您将鼠标悬停在上面时,它会弹出。 It works fine on all browsers but not IE. 它适用于所有浏览器,但不适用于IE。 Any help would be greatly appreciated. 任何帮助将不胜感激。

Here is my table: 这是我的桌子:

     <div id="face">
            <table>
                <tr><td style="background-color:#3b5997;">
                    <table>
                    <tr>
                        <td>
                             <img alt="face" src="img/face.png" style="height: 100px;" />
                        </td>
                        <td>
<!--ADD FACEBOOK CODE HERE--><div class="fb-like" data-href="http://www.facebook.com/ThePaxtonHotel" data-send="false" data-layout="box_count" data-width="450" data-show-faces="false" data-colorscheme="dark"></div>

                        </td>
                    </tr>
                    </table>
               </td></tr>
            </table>
          </div> 

Here is the css: 这是CSS:

#face{
    top:60px;
    right: -55px;
    position: absolute;
}

#face:hover{
    right: 0px; 
}

Here is a fiddle: social hover 这是一个小提琴: 社交悬停

From what I know, older versions of IE don't support the "hover" psudeo-class on DIV elements. 据我了解,IE的较早版本不支持DIV元素上的“悬停”伪类。

Two routes i can think of are to wrap it in an "a" tag and make that your #face ID to get hover to trigger. 我可以想到的两条路线是将其包装在“ a”标签中,并使您的#face ID悬停触发。 This probably isn't going to work well for you becuase you have interactive elements inside. 因为您内部有交互式元素,所以这可能无法很好地工作。

The second is to have a js fallback. 第二个是让js回退。 Check this fiddle for an example (Note: I used jquery in the example): 查看这个小提琴作为示例(注意:我在示例中使用了jquery):

http://jsfiddle.net/zensign/Gr7C8/1/ http://jsfiddle.net/zensign/Gr7C8/1/

JS Snippet: JS代码段:

if($.browser.msie)
{
    $('#face').mouseenter(function (e) {
        $(this).addClass('fallback');
    });

    $('#face').mouseleave(function (e) {
        $(this).removeClass('fallback');
    });
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM