簡體   English   中英

qtip2設置屬性,但在打開jquery時不顯示。(鼠標懸停)

[英]qtip2 sets attributes but doesn't show with jquery on.(mouseover)

這是我用來顯示qtips的代碼:

$(document).on('mouseover', '.sktooltip', function(event) {
    // Bind the qTip within the event handler
    $(this).qtip({
        overwrite: false, // Make sure the tooltip won't be overridden once created
        content: 'ToolTip!',
        target: 'mouse',
        show: {
            event: event.type, // Use the same show event as the one that triggered the event handler
            ready: true // Show the tooltip as soon as it's bound, vital so it shows up the first time you hover!
        }
    }, event); // Pass through our original event to qTip
})

// Store our title attribute in 'oldtitle' attribute instead
.each(function(i) {
    $.attr(this, 'oldtitle', $.attr(this, 'title'));
    this.removeAttribute('title');
});

它基本上與文檔中的相同。

現在,在將鼠標懸停在其上之前,相關的HTML:

<div class="service-block msr">
    <a target="_blank" href="http://google.de">
    <div class="service-image msrc">
        <img rel="254" data-original="123.png" class="sktooltip" src="123.png" style="display: inline;">
    </div></a>
    <h4><a target="_blank" href="http://google.de">Google</a></h4>
    <p>Search Engine</p>
</div>

之后:

<div class="service-block msr">
    <a target="_blank" href="http://google.de">
    <div class="service-image msrc">
        <img rel="254" data-original="123.png" class="sktooltip" src="123.png" style="display: inline;" data-hasqtip="0" aria-describedby="qtip-0">
    </div></a>
    <h4><a target="_blank" href="http://google.de">Google</a></h4>
    <p>Search engine</p>
</div>

如您所見,qtip將其屬性插入到元素中,但我看不到工具提示。 我想念什么?

編輯:它確實在這里工作,但不在我的網站上: http : //jsfiddle.net/Dayjay/738nX/

現在可以使用! 我使用的jquery.isotope實現了imagesLoaded插件的舊版本,這導致qTip2出現問題。 要解決此問題,只需在同位素腳本之后添加最新的imagesLoaded腳本即可。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM