我在使用qTip2使带有html内容的弹出窗口工作时遇到了一些困难。显示的弹出窗口是空白的,我不知道为什么。
这是我的javascript:
$('.tooltip').qtip({
content: {
text: function(api){
$(this).next('.tooltip-content');
}
}
});我的html是:
<a class="tooltip"></a>
<div class="tooltip-content"><strong>this is some tooltip</strong> content. <em>italic</em></div>我已经设置了一个显示我的问题的小提琴-- http://jsfiddle.net/tajsy/
我计划有很多这些工具提示在一个页面上,所以我想把链接和隐藏的div与它的内容配对。
有人能告诉我哪里出了问题吗?
发布于 2012-10-18 14:49:59
由于使用的是函数,因此需要返回元素:
text: function(api){
return $(this).next('.tooltip-content');
}发布于 2014-05-20 10:16:01
qtip2内联http://jsfiddle.net/uaR3m/20/
$('a').each(function() {
$(this).qtip({
content: {
text: function(api){
return $($(this).attr('href'));
}
}
});
});https://stackoverflow.com/questions/12957390
复制相似问题