Glitter solution when calling jQuery to slide out

  • 2020-03-30 02:29:39
  • OfStack

As shown in the problem, the layer will now flash once when the jQuery effect is called. I have found a lot of solution documents on the Internet, and I want to add the following signs:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

The problem is that the header is now html4.0, and if you change it to the above, the page will be messy. Finally found a master to write the east, rewrite the jQuery slide-out

The effect. The master's link address is as follows:
http://aqr199.myweb.hinet.net/jquery_slide_iebug.htm

The code is as follows:
 
var b1 = new slide_fix($('#Div3')); 
$('#Button5').click(function(){b1.close();});// closed  
$('#Button6').click(function(){b1.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) ? 1 : (t1-t)/step; 
fn(count,rate); 
if(rate==1){clearInterval(timeId);} 
count++; 
},time); 
} 

function now() { 
return (new Date).getTime(); 
} 
} 

Related articles: