我的 qtip 插件有问题。当我将鼠标悬停在用户头像上时,qtip div 中未显示。 我的列出用户的代码:
<% foreach (var user in Model){%>
<div class="avatar">
<img src="<%=Html.Encode(user.showavatar())%>">
</div>
<div class="username" style="display:none">
<%=Html.Encode(user.Username) %>
</div>
<%}%>
当鼠标悬停在用户 div 上时显示用户名的 JQuery 代码。
$('.avatar').each(function () {
$(this).qtip({
content: {
content: $(this).next('.username').html()
},
show: 'mouseover',
hide: 'mouseout'
})
});
有什么建议吗?
最佳答案
看起来您有一个额外的嵌套“内容” map 。更改这些行:
content: {
content: $(this).next('.username').html()
},
对此:
content: $(this).next('.username').html(),
关于JQuery QTip 插件 foreach 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6010051/