簡體   English   中英

qTip2-顯示其他目標

[英]qTip2 - show a different target

我嘗試創建一個在單擊任何按鈕時在圖像上打開氣泡的函數:

$(document).on('click', '#MyButton', Check_Index);
function Check_Index() {
    $('img').qtip({
        content: {text:"hello !"}
    });
};

在這種情況下,當我單擊按鈕后在圖像上傳遞微笑時,氣泡會打開。 但這不是我想要的...

您可以在此處查看演示: http : //jsfiddle.net/qtyTJ/206/

您可以在這里看到插件: http : //qtip2.com/

如果要在單擊按鈕后立即顯示,只需添加下一個代碼

$(document).on('click', '#MyButton', Check_Index);

function Check_Index() {
        $('img').qtip({
            content: {text:"hello !"},
            show: true
         });
};

您也可以使用hide選項,例如

     $('img').qtip({
        content: {text:"hello !"},
        show: true,
        hide: {
            delay: 300
        }
    });

看這個演示

要訪問qtip api,您可以執行以下操作:

// Create the tooltip first using regular .qtip() call
var tooltips = $('.selector').qtip({
    /* configuration options here */
});

// Grab the first element in the tooltips array and access its qTip API
var api = tooltips.qtip('api');

所以現在您可以訪問api

api.hide();
api.show();

您可以在找到的所有api文檔

暫無
暫無

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

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