Maison > interface Web > js tutoriel > le corps du texte

解决jQuery插件tipswindown与hintbox冲突_jquery

WBOY
Libérer: 2016-05-16 18:17:00
original
1008 Les gens l'ont consulté

使用情形如下:

页面a.aspx中点击按钮弹出模拟层,在这个层中有一个输入文本框“监督人”处调用hintbox来产生即时查询功能。

直接调用产生了如下情形:

于是找到jquery.hintbox-1.3.js这个文件,发现其中出现这么一行:

复制代码 代码如下:

$("#windown-content").ajaxStart(function(){
$(this).html("解决jQuery插件tipswindown与hintbox冲突_jquery");
});

将其改为:
复制代码 代码如下:

$("#windown-content").html("解决jQuery插件tipswindown与hintbox冲突_jquery");

原因是两个插件即使是在不同情形下触发ajax事件,使用的仍是同一对象,即jQuery.js中出现的
复制代码 代码如下:

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: "*/*"
}
},

这样在当前窗体中就会是只有一个xhr对象存在,因为在hintbox中的ajax事件会触发tipswindown的ajaxStart事件。

可下载修改过后的tipswindown,点击下载
Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!