欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決jQuery插件tipswindown與hintbox沖突

 更新時間:2010年11月05日 22:16:55   作者:  
先掃下盲:tipswindown是jQuery的彈窗插件,可以使用url或當(dāng)前頁元素顯示在模擬層中;hintbox是jQuery的類似Google Suggestions插件。
使用情形如下:

頁面a.aspx中點擊按鈕彈出模擬層,在這個層中有一個輸入文本框“監(jiān)督人”處調(diào)用hintbox來產(chǎn)生即時查詢功能。

直接調(diào)用產(chǎn)生了如下情形:

于是找到j(luò)query.hintbox-1.3.js這個文件,發(fā)現(xiàn)其中出現(xiàn)這么一行:

復(fù)制代碼 代碼如下:

$("#windown-content").ajaxStart(function(){
$(this).html("<img src='"+templateSrc+"/images/loading.gif' class='loading' />");
});

將其改為:
復(fù)制代碼 代碼如下:

$("#windown-content").html("<img src='"+templateSrc+"/images/loading.gif' class='loading' />");

原因是兩個插件即使是在不同情形下觸發(fā)ajax事件,使用的仍是同一對象,即jQuery.js中出現(xiàn)的
復(fù)制代碼 代碼如下:

ajaxSetup: function( settings ) {
jQuery.extend( jQuery.ajaxSettings, settings );
},

ajaxSettings: {
url: location.href,
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded",
processData: true,
async: true,
/*
timeout: 0,
data: null,
username: null,
password: null,
*/
// Create the request object; Microsoft failed to properly
// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
// This function can be overriden by calling jQuery.ajaxSetup
xhr:function(){
return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
},
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
script: "text/javascript, application/javascript",
json: "application/json, text/javascript",
text: "text/plain",
_default: "*/*"
}
},

這樣在當(dāng)前窗體中就會是只有一個xhr對象存在,因為在hintbox中的ajax事件會觸發(fā)tipswindown的ajaxStart事件。

可下載修改過后的tipswindown,點擊下載

相關(guān)文章

最新評論