簡體   English   中英

引導程序Popover內部

[英]bootstrap Popover inside

我在模態中顯示一個彈出窗口,但可以將其隱藏在關閉狀態,但是在從模態中單擊時無法隱藏它。 我試圖將其隱藏起來,這很好。 代碼在這里

$('.close, .close-button').click(function(){
    $(".popover.bottom").css('display', 'none');
});

我試圖通過單擊模態之外來隱藏,但是當我在模態內部單擊時它是隱藏的。

$("#myModal").click(function(){
    if(($("#myModal").attr('aria-hidden')) == 'false'){
        $(".popover.bottom").not('.modal-content').css('display', 'none');
    }
});

在這方面有人可以幫助我嗎?

$("#myModal").click(function(){

    if(!$("#myModal").attr('aria-hidden')){

        $(".popover.bottom").not('.modal-content').hide();
    }

});

我有一個類似的問題。 您能試試看嗎? 從引導替換您的ID /類。

$('[data-toggle="popover"]').popover();

    $('body').on('click', function (e) {
        $('[data-toggle="popover"]').each(function () {
            //the 'is' for buttons that trigger popups
            //the 'has' for icons within a button that triggers a popup
            if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
                $(this).popover('hide');
            }
        });
 });

供參考: http : //jsfiddle.net/mattdlockyer/C5GBU/2/

我已經使用了

$("#myModal").on('hidden.bs.modal', function(){
    $(".popover.bottom").css('display', 'none');
});

暫無
暫無

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

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