我正在使用 jQuery AJAX 调用加载页面的一部分,并希望在该部分中使用 qTips。通常,当通过 AJAX 加载 jQuery 函数时,您会使用该.live()
函数。有没有办法使用 qTip.live()
或是否有等效的 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 来加载表单。