This article mainly introduces the solution that the layer will flash twice when calling jQuery to slide out the effect. If you need it, refer to the problem phenomenon as shown in the question, when jQuery is called to slide out, the layer will flash for a moment. I found a lot of solutions on the Internet and added the following labels:
The Code is as follows:
The problem is that the title header is now html4.0. If it is changed to the above, the page will be out of order. Finally, I found a highly-handwritten stuff, And the rewritten jQuery slide out.
Effect. The links of experts are as follows:
Http://aqr199.myweb.hinet.net/jquery_slide_iebug.htm
The Code is as follows:
The Code is as follows:
Var b1 = new slide_fix ($ ('# Div3 '));
$ ('# Button5'). click (function () {b1.close () ;}); //
$ ('# Button6'). click (function () {b1.open () ;}); // open
Function slide_fix (B ){
Var h = B. height ();
Var step = 600;
Var time = 13;
This. open = function (){
TimeRate (step, function (c, r ){
Var h1 = h * r;
B. height (h1 );
If (c = 1) {B. show ();}
});
}
This. close = function (){
TimeRate (step, function (c, r ){
Var h1 = h * (1-r );
B. height (h1 );
If (r = 1) {B. hide ();}
});
}
Function timeRate (step, fn ){
Var t = now ();
Var count = 1;
Var timeId = setInterval (function (){
Var t1 = now ();
Var rate = (t1-t)> step )? (T1-t)/step;
Fn (count, rate );
If (rate = 1) {clearInterval (timeId );}
Count ++;
}, Time );
}
Function now (){
Return (new Date). getTime ();
}
}