我正在翻譯社交網絡,並在帖子中我需要顯示每個建議的投票(類似於在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>
任何幫助嗎?
謝謝,這就是我想要的,它對我很好! :) –
@ParcRoi不客氣 – Blindsyde