How to flash when jQuery is called to slide the result _ javascript skills

Source: Internet
Author: User
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 ();
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.