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 を使用してフォームをロードすることにも言及する必要があります。