我正在用jQuery AJAX调用加载我的页面的一部分,并希望在该部分中使用qTips。通常在通过AJAX加载jQuery函数时,您可以使用.live()
函数。有没有办法使用.live()
附加qTip或是否有qTip等效?qtip live()支持
我听说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加载表单。
嗯,谢谢你的回应。第一个链接是我见过的。这对我来说合理,逻辑上应该工作,但似乎没有。它的行为就像创建自己的副本一样。每次我打电话给qTip时,都会打更多的电话(例如,第一次,第二次:2等)。第二个环节对我来说没有多大意义。这不是你在静态页面上添加qtips的正常方式吗? – emachine 2010-12-15 16:53:54