我在我的頁面中使用了qtip圖像的代碼如下。它通過ajax post顯示每個圖像的動態內容。但它並沒有顯示ThickBox的/ jQuery UI的對話框關閉後qtip並引發錯誤:$(本).qtip不是一個函數
<script src="<%= Config.VirtualDir %>js/jquery.js?v=2" type="text/javascript"></script>
<script src="<%= Config.VirtualDir %>js/jquery.qtip-1.0.0-rc3.min.js?v=2" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
BindQtip();
});
function BindQtip()
{
$('image').each(function(){
$(this).live('click',function() {
var $img = $(this);
if('<%= objAdminAuth.GetUserID() %>' == $img.attr('data-uid').split('|')[0])
{
return false;
}
if ($img.data('qtip')) {return false;}
$(this).qtip({
content: 'Loading...',
style: {
border: {
width: 5,
radius: 10
},
padding: 0,
textAlign: 'center',
tip: true, // Give it a speech bubble tip with automatic corner detection
name: 'dark' // Style it according to the preset 'cream' style
},
hide: 'unfocus',
show: {
when: 'click', // Don't specify a show event
ready: true, // Show the tooltip when ready
solo: true
},
position: {
corner: {
tooltip: 'rightMiddle', // Use the corner...
target: 'bottomLeft' // ...and opposite corner
}
},
api: {
// Retrieve the content when tooltip is first rendered
onRender: function() {
var self = this;
self.content = '';
$.ajax({
url: window.location.href,
type: 'POST',
data: 'call=ajax&uid=' + $img.attr('data-uid'),
success: function(resp) {
self.updateContent(resp);
}
});
},
onContentUpdate: function() {
var self = this;
}
}
});
});
});
}
</script>
所有的路徑是正確的,其他的東西很好地工作。我錯過了什麼?
任何幫助,將不勝感激。
看起來像你的JS的登記已運行特定的代碼後,正在發生。也許嘗試另一種方法(註冊在主)來鏈接你的JS和測試,看看是否是這樣。 – ericosg
你確定qTip庫加載正確嗎? – JJJ
在BindQtip()之前放置alert()。如果它工作,ericosg是正確的。 – Ashwin