悬停在警报上时的Bootstrap Popover

时间:2015-12-03 09:34:15

标签: javascript jquery css twitter-bootstrap jsp

我正在创建一个通知窗口,我正在使用bootstrap警报类,我已经修剪了字符串,但是当用户将鼠标悬停在它们上时,我想将整个通知显示为popover。这是我用来显示通知的代码

<div class="alert alert-success fade in">
<a style="padding: 0px" href="#" class="close"                                                          data-dismiss="alert"                        onclick="makeArchive(${notifications.notificationId})">&times;</a>
<strong style="cursor: pointer;" data-container="body"
data-toggle="usersMobile" data-placement="right"
data-trigger="hover" data-animation="true"
onmouseover="showPopover(${notifications.notificationText})"
data-content="${notifications.notificationText}"
onclick="openModal(${notifications.notificationId})">
<c:out value="${notifications.trimmedString}"></c:out>
</strong>

在鼠标悬停时,我调用popOver函数

function popOver(notificationId){

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

}

但是popover没有显示

谢谢

1 个答案:

答案 0 :(得分:0)

在显示弹出窗口之前,您需要初始化弹出窗口。以下链接是您的代码的小提琴。

http://jsfiddle.net/1tLof1ph/12/

$('[data-toggle="usersMobile"]').popover({html : true});

-Thanks