第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在動(dòng)態(tài)元素上綁定引導(dǎo)彈出窗口

如何在動(dòng)態(tài)元素上綁定引導(dǎo)彈出窗口

慕田峪7331174 2019-12-21 13:13:11
我正在動(dòng)態(tài)列表上使用Twitter Bootstrap的彈出窗口。列表項(xiàng)有一個(gè)按鈕,當(dāng)我單擊該按鈕時(shí),它將顯示彈出窗口。當(dāng)我在非動(dòng)態(tài)環(huán)境下進(jìn)行測試時(shí),它可以正常工作。這是我的非動(dòng)態(tài)列表JavaScript$("button[rel=popover]").popover({     placement : 'right',    container : 'body',    html : true,    //content:" <div style='color:red'>This is your div content</div>"    content: function() {      return $('#popover-content').html();    }    })    .click(function(e) {        e.preventDefault();});但是,它在動(dòng)態(tài)列表上效果不佳。當(dāng)我單擊“兩次”按鈕時(shí),它可以顯示,并且僅顯示我單擊第一時(shí)間的列表項(xiàng)之一。我的HTML: <ul id="project-list" class="nav nav-list">   <li class='project-name'>     <a >project name 1         <button class="pop-function" rel="popover" ></button>     </a>   </li>   <li class='project-name'>     <a>project name 2        <button class="pop-function" rel="popover" ></button>     </a>   </li> </ul><div id="popover-content" style="display:none">    <button class="pop-sync"></button>    <button class="pop-delete"></button></div>我的動(dòng)態(tài)JavaScript:$(document).on("click", "#project-list li" , function(){   var username = $.cookie("username");   var projectName = $(this).text()   $("li.active").removeClass("active");   $(this).addClass("active");   console.log("username: " +username + " project name: "+projectName );});$(document).on("click", "button[rel=popover]", function(){    $(this).popover({        placement : 'right',       container : 'body',       html : true,    content: function() {       return $('#popover-content').html();        }    }).click(function(e){    e.preventDefault();    })});//for close other popover when one popover button click$(document).on("click", "button[rel=popover]" , function(){        $("button[rel=popover]").not(this).popover('hide'); });我已經(jīng)搜索過類似的問題,但是仍然找不到解決我的問題的方法。如果有人有什么想法,請告訴我。感謝您的幫助。
查看完整描述

3 回答

?
慕尼黑5688855

TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超2個(gè)贊

可能為時(shí)已晚,但這是另一種選擇:


 $('body').popover({

    selector: '[rel=popover]',

    trigger: 'hover',

    html: true,

    content: function () {

        return $(this).parents('.row').first().find('.metaContainer').html();

    }

});


查看完整回答
反對 回復(fù) 2019-12-21
  • 3 回答
  • 0 關(guān)注
  • 609 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)