【发布时间】:2016-09-30 21:07:11
【问题描述】:
我正在翻译社交网络,在帖子中我需要显示一些关于每个建议的投票的统计信息(类似于 stackoverflow 中的答案),所以每当用户将鼠标悬停在带有动态的标签上时,我都需要创建弹出框内容。
function Popx(id)
{
$(id).popover({//here is my problem, I want dynamic id not static
html: true,
trigger: 'hover',
content: function () {
return $.ajax({url: 'ajax/ajaxpopoverstat.php?uid=1',
dataType: 'html',
async: false}).responseText;
}
}).hover(function (e) {
$(this).popover('toggle');
});
}
<div class="label label-default" style="background-color: orange; font-size: x-large" data-poload="ajax/ajaxpopoverstat.php" id="xword" onmouseover="Popx(this.id)">Suggested Word</div>
有什么帮助吗?
【问题讨论】:
标签: javascript php jquery html twitter-bootstrap