【问题标题】:Jquery tooltip positioning function behave differently in browsersjQuery 工具提示定位功能在浏览器中的行为不同
【发布时间】:2014-01-30 18:44:57
【问题描述】:

我是 javascript 的新手,尝试使用工具提示在网页上显示图像标题。

我根据各种示例改编的代码在 Firefox 上按预期工作,但在 Google Chrome 上颠倒了 my & at 位置,在 IE 上根本不工作。

   <script>
    $(function() {
        $( document ).tooltip( { position: {my: 'center bottom+10' , at: 'center top'}});
      });
  </script> 

这是在 Chrome 和 Firefox 中可以正常使用的样式,但在 IE 中无法调整大小或显示弯角

<style type="text/css">
 .ui-tooltip-content {
    display: inline-block;
    background:transparent;
    padding:5px;
    font: bold 14px "Arial", Sans-Serif;
    color: #000080;


    }    
   .ui-tooltip {
    padding: 10px 20px;    
    color:#eee;
    border-radius: 20px;    
    box-shadow: 0 0 7px black;
  }
</style>

图书馆详情

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">

有问题的页面在这里 http://www.millwall-history.org.uk/Season_1982-83.htm

【问题讨论】:

  • 什么版本的IE? IE 直到版本 9 才支持border-radius
  • 另外,如果您希望我们为其 API 提供帮助,您需要指明您正在使用的工具提示库/插件。
  • IE 9 是我检查它的那个。

标签: javascript jquery html css cross-browser


【解决方案1】:

解决方法是包含以下元标记

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

这使工具提示功能起作用,并在表格上显示弯曲的边框。

我无法解决的一个恼人的错误是 IE 和 Google 中的 my 和 at 位置与 Firefox 中的相反!

【讨论】:

    【解决方案2】:

    您是否尝试过使用正文选择器而不是文档选择器?

    $( body ).tooltip( { position: {my: 'center bottom+10' , at: 'center top'}});
    

    对于你需要的边界半径:

    .ui-tooltip {
        padding: 10px 20px;    
        color:#eee;
        -webkit-border-radius: 20px;
        -moz-border-radius: 20px;
        border-radius: 20px;   
        box-shadow: 0 0 7px black;
      }
    

    【讨论】:

    • 刚刚试了一下,提示提示完全停止了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-04
    • 1970-01-01
    • 2012-09-14
    • 1970-01-01
    相关资源
    最近更新 更多