【问题标题】:jquery pjax + jquery tipsy the tooltip doesn't hide on mouseout after clickjquery pjax + jquery Tipsy 单击后工具提示不会在鼠标悬停时隐藏
【发布时间】:2012-02-22 10:50:32
【问题描述】:

在 pjax 链接上使用 jquery.tipsy 时,工具提示在单击后不会在 mouseout 上隐藏。

这可能意味着在单击之后,此元素未附加 mouseout 事件,这就是问题存在的原因?

这是我如何加载 pjax 和 Tipsy()

$(function () {
    $('[data-pjax]').pjax('#offer-table', {timeout: 100000})
})


<script type='text/javascript'>
  $('a.tipsy').tipsy({delayIn: 500});
</script>

jquery-pjax:https://github.com/defunkt/jquery-pjax

jquery 喝醉了:http://onehackoranother.com/projects/jquery/tipsy/

编辑:如果将live: true 添加到tipsy() 中,结果相同。

【问题讨论】:

  • 您应该始终包含指向插件参考/来源的链接,这样人们就不必为了帮助您而去搜索。
  • 已添加,感谢提供信息。
  • 页面上的所有链接都是这种情况吗?或者只是那些属于#offer-table 子的链接?
  • @jessegavin:没错。该问题仅发生在#offer-table 内的链接。

标签: javascript jquery pjax tipsy


【解决方案1】:

我也遇到过类似的问题。页面对&lt;div data-pjax-container&gt; 的内容使用pjax。容器内的元素具有在鼠标悬停时显示并在鼠标悬停时隐藏的提示。如果我触发了 pjax 更改,然后在元素更改时将其悬停,那么醉酒将永远无法隐藏,因为不再有可以鼠标移出的元素。

这就是我最终做的,作为 CoffeeScript:

PJAX_TIPSY_CLASS = "pjax-tipsy"

$element.tipsy(live: true, className: PJAX_TIPSY_CLASS)

# pjax changes could leave a tipsy up from the old page.
$pjaxContainer = $('[data-pjax-container]')
$pjaxContainer.bind 'pjax:end', ->
  $(".#{PJAX_TIPSY_CLASS}").remove()

或作为 JavaScript:

var PJAX_TIPSY_CLASS = "pjax-tipsy";

$element.tipsy({ live: true, className: PJAX_TIPSY_CLASS });

var $pjaxContainer = $('[data-pjax-container]');
$pjaxContainer.bind('pjax:end', function() {
  $("." + PJAX_TIPSY_CLASS).remove();
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-01
    • 1970-01-01
    相关资源
    最近更新 更多