【问题标题】:Adding bootstrap popover not working添加引导弹出窗口不起作用
【发布时间】:2013-08-28 22:11:53
【问题描述】:

在我的代码中,我正在设置表格的 HTML 内容,并且我想在将鼠标悬停在表格的每个单元格上时显示弹出框。我为此使用引导程序。

在javascript中:

html = html + "<td>"+data[i]["initial_score"]+"</td>";
        html = html + "<td onmouseover=\"showpopover('"+main_image_data['score_reason']+"')\">"+main_image_data['bonus']+"</td>";
        html = html + "<td>"+variant_data['bonus']+"</td>";

showpopover 函数:

showpopover=function(message){
    $(this).popover({ placement: "bottom",title:"Score",content:"<div>THIS IS SCORE</div>"});   
};

但是,当我将鼠标悬停在单元格上时,它不会显示任何弹出框。 我是否在 showpopover 函数中错误地使用了“this”?

【问题讨论】:

    标签: javascript jquery twitter-bootstrap


    【解决方案1】:

    这是工作的Fiddle希望它对你有帮助!

     $popover = $(val).popover({ 
        trigger: "hover",
        placement: "bottom",
        title:"Score",
        content:"<div>THIS IS SCORE</div>"
     });
    

    【讨论】:

    • 由于内容是 html,请务必将 {html: true} 添加到弹出框的选项中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-12-21
    • 2013-03-25
    • 1970-01-01
    • 2012-12-05
    • 2013-05-22
    相关资源
    最近更新 更多