【问题标题】:Multiple Qtips on one element not working一个元素上的多个 Qtip 不起作用
【发布时间】:2014-06-30 16:45:47
【问题描述】:

构建日历,当用户将鼠标悬停在一天上时,我希望显示一个工具提示,但如果用户点击这一天,我希望显示一个单独的工具提示。到目前为止,当我悬停时没有任何反应,但是当我单击它时它会起作用。

HTML:

echo "<span><a href='#' class='add_event_tooltip tooltip' title="\$list_day\">$list_day</a></span>";

jquery:

<script type="text/javascript"><!-- TOOL TIP -->
$('.tooltip').live('mouseover', function(event) {
   $(this).qtip({
      overwrite: true, 
      position: { viewport: $(window)},   
       style: {
       classes: 'ui-tooltip-shadow ui-tooltip-rounded'
      },
      show: {
         event: event.type, 
         ready: true 
      }
   }, event); 
})
</script>
<script language="javascript" type="text/javascript">
$('.add_event_tooltip').qtip({
        content: {
            ajax: { 
                url: 'test.html'
            },
        },
        position: {
            my: 'center', // ...at the center of the viewport
            at: 'center',
            target: $(window)
        },
        show: {
            event: 'click', // Show it on click...
            solo: true, // ...and hide all other tooltips...
            modal: true // ...and make it modal
        },
        hide: false,
        style: 'ui-tooltip-light ui-tooltip-rounded'
});
</script>

一个类是否有可能压倒另一个类?是这样,我怎样才能得到这个,以便两个工具提示可以相互工作,鼠标悬停时的 .tooltip 和点击时的 .add_event_tool 。

谢谢。

【问题讨论】:

    标签: jquery tooltip qtip


    【解决方案1】:
    style:"class: 'ui-tooltip-shadow ui-tooltip-rounded'"
    

    它不应该是类,尝试将其更改为类。

    style:"class:'ui-tooltip-light ui-tooltip-rounded'"
    

    你在这里缺课,其他的都很好。现在试试

    【讨论】:

    • 抱歉,这只是 qtip 本身的样式,没有问题。
    【解决方案2】:

    解决方案现在可能已随着最新版本的 qTip2 发生变化。为了让多个 qTips 在同一个目标上工作,我必须将 overwrite:false 选项添加到第二个 qtip。

    http://qtip2.com/options#core.overwrite

    【讨论】:

      猜你喜欢
      • 2012-05-30
      • 2017-06-27
      • 1970-01-01
      • 1970-01-01
      • 2021-06-18
      • 2017-07-16
      • 2013-08-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多