【发布时间】:2015-07-24 09:27:53
【问题描述】:
我尝试使用弹出框https://github.com/sandywalker/webui-popover。我需要“quora”弹出框功能:链接应该是可点击的,但悬停应该显示带有 ajax 加载内容的弹出框。
我尝试了以下方法:
$(function(){
function details_in_popup(link, div_id){
$.ajax({
url: link,
success: function(response){
$('#'+div_id).html(response);
}
});
return '<div id="'+ div_id +'">Loading...</div>';
}
$('a.user_popover').livequery(function(){
var link = 'your_url_there';
$(this).webuiPopover({
content: function(data){
var div_id = "tmp-id-" + $.now();
return details_in_popup(link, div_id);
},
placement: 'bottom',
trigger: 'hover',
cache: false
});
})
})
【问题讨论】:
-
你到底是哪里出了问题?
-
无法对 ajax 加载的内容使用“悬停”事件。如果我将 'async' 类型与 'url' 一起使用,则仅通过单击触发弹出框。