简体   繁体   English

JQuery工具提示在Internet Explorer中不起作用

[英]JQuery Tooltip Not Working In Internet Explorer

I have a JQuery tooltip that won't show in IE when I deploy to my application server. 我有一个JQuery工具提示,当我将其部署到我的应用程序服务器时不会在IE中显示。 It works when I debug it locally on my computer using IE, and it also works in Chrome on the server and locally. 当我使用IE在我的计算机上本地调试它时,它可以工作,并且也可以在服务器上和本地的Chrome中运行。 How can I fix this to make it work with IE on the server? 如何解决此问题,使其与服务器上的IE一起使用?

<script src="https://code.jquery.com/jquery-3.2.1.min.js" type="text/javascript"></script>
<style type="text/css">
    .tooltip {
        display:none;
        position:absolute;
        border:1px solid #333;
        background-color:#161616;
        border-radius:5px;
        padding:10px;
        color:#fff;
        font-size:12px;
    }
</style>
<script type="text/javascript">$(document).ready(function () {
   // Tooltip only Text
   $('.masterTooltip').hover(function () {
    // Hover over code
    var title = $(this).attr('title');
    $(this).data('tipText', title).removeAttr('title');
    $('<p class="tooltip"></p>')
    .text(title)
    .appendTo('body')
    .fadeIn('slow');
    }, function () {
    // Hover out code
    $(this).attr('title', $(this).data('tipText'));
    $('.tooltip').remove();
    }).click(function (e) {
    var mousex = e.pageX + 20; //Get X coordinates
    var mousey = e.pageY + 10; //Get Y coordinates
    $('.tooltip')
    .css({ top: mousey, left: mousex })
    });
});
</script>

How it looks like in Chrome: 在Chrome中的外观:

在此处输入图片说明

Did you check if all the .js files are loaded properly in IE while browsing from server? 从服务器浏览时,是否检查IE中是否正确加载了所有.js文件? Please check in Network window of IE developer tools (can be loaded by using F12 key). 请在IE开发人员工具的“网络”窗口中检查(可以使用F12键加载)。

You may want to run the page from server without Compatibility mode. 您可能要从没有兼容模式的服务器运行页面。 You can also disable the compatibility mode by adding this in your HTML header- 您也可以通过在HTML标头中添加兼容模式来禁用兼容模式-

<meta http-equiv="X-UA-Compatible" content="IE=edge">

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

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