This article mainly through the code example to introduce the IE7 browser window size Change event to perform many bugs and ie6/ie7/ie8 under the resize problem, step-by-step introduction, first to introduce IE7 browser window size Change event to perform multiple bugs, specific problem analysis and solutions please see below.
var resizetimer = null;
$ (window). Resize (function () {
if (resizetimer) cleartimeout (resizetimer);
Resizetimer = settimeout ("alert (' mm ')";
});
There is also a parity to determine the variables to solve (feel this method is also OK)
The code is as follows:
var n=0;
$ (window). Resize (function () {
if (n%2==0) {
alert ("mm");
}
n++;
});
Whether the jquery package or JS native will produce this bug
IE6/IE7/IE8 jquery Resize Event Execution multiple solutions
In the Resize event using jquery found that every time you change the browser window large hours resize time will be performed two times, Baidu search for a way to find a solution,
Use settimeout to solve this problem code as follows:
var resizetimer = null;
$ (window). Resize (function () {
if (resizetimer) cleartimeout (resizetimer);
Resizetimer = settimeout ("alert (' mm ')";
});
There is also a solution by judging the parity of the variable (feeling this method is also OK), the code is as follows:
var n=0;
$ (window). Resize (function () {
if (n%2==0) {
alert ("mm");
}
n++;
});
The above is this article for IE7 browser window size Change event to perform many bugs and ie6/ie7/ie8 under the resize problem, I hope to help.