我正在使用jQuery AJAX调用加载页面的一部分,并希望在该部分中使用qTips。通常,在通过AJAX加载jQuery函数时,需要使用.live()函数。有没有一种方法可以使用.live()连接qTip,或者是否有qTip的等价物?
我听说qTip 2.0将提供这种支持,但我不认为2.0已经准备好了。
有没有人有变通的办法?
下面是我认为应该可以工作但似乎不能工作的完整代码:
$('.editquestion').live('click', function() {
$(this).qtip({
overwrite:false,
content: {
url: $(this).attr('href'),
data: { id: 5 },
method: 'get',
title: {
text: 'Edit Question',
button: 'Close'
},
cache: false,
},
position: {
target: $(document.body), // Position it via the document body...
corner: 'center' // ...at the center of the viewport
},
show: {
ready:true,
},
hide: false,
style: {
width: {
max: 550,
min: 550
},
height: {
max: 300,
min:300
},
padding: '14px',
border: {
width: 9,
radius: 9,
color: '#666666'
},
name: 'light'
},
api: {
beforeShow: function() {
// Fade in the modal "blanket" using the defined show speed
$('#qtip-blanket').fadeIn(this.options.show.effect.length);
},
beforeHide: function() {
// Fade out the modal "blanket" using the defined hide speed
$('#qtip-blanket').fadeOut(this.options.hide.effect.length);
}
}
});
return false;
});编辑:也许我还应该提一下,qtip使用ajax加载表单。
发布于 2010-12-16 00:32:24
发布于 2010-12-16 05:41:57
您应该在加载页面的新部分时附加qtip,而不是单击。
您还可以在单击时附加之前,尝试检查qtip是否已附加到所单击的对象。Firebug会告诉你要检查什么。
https://stackoverflow.com/questions/4452188
复制相似问题