Home > Web Front-end > JS Tutorial > body text

Solve the conflict between jQuery plug-in tipswindow and hintbox_jquery

WBOY
Release: 2016-05-16 18:17:00
Original
1009 people have browsed it

The usage situation is as follows:

Click the button in page a.aspx to pop up the simulation layer. In this layer, there is an input text box "Supervisor" that calls hintbox to generate an instant query function.

Direct call produces the following situation:

So I found the file jquery.hintbox-1.3.js and found this line:

Copy the code The code is as follows:

$("#windown-content").ajaxStart(function(){
$(this).html("");
});

Change it to:
Copy code The code is as follows:

$("#windown-content").html("");

The reason is that even if the two plug-ins trigger the ajax event under different circumstances, they still use the same object, that is, the
Copy code The code is as follows:
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: "*/*"
}
},

In this way, only one xhr object will exist in the current form, because the ajax event in hintbox will trigger the ajaxStart event of tipswindow.

You can download the modified tipswindown,
click to download.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!