![ContractedBlock.gif](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
function
toMinBox(obj) {
var speed = 10 ;
function strechH() {
var h = obj.offsetHeight;
if (h - speed <= 0 ) {
obj.style.display = " none " ;
clearInterval(intervalID_Min);
}
else {
obj.style.height = (h - speed) + " px " ;
}
}
intervalID_Min = setInterval(strechH, 2 );
}
function toMaxBox(obj) {
obj.style.display = " block " ;
var speed = 10 ;
var originalHeight = ! obj.childNodes[ 0 ].offsetHeight ? obj.getElementsByTagName( " ul " )[ 0 ].offsetHeight : obj.childNodes[ 0 ].offsetHeight;
function strechM() {
var h = obj.offsetHeight;
if (h >= originalHeight) {
clearInterval(intervalID_Max);
}
else {
obj.style.height = (h + speed) + " px " ;
}
}
intervalID_Max = setInterval(strechM, 2 );
}
var speed = 10 ;
function strechH() {
var h = obj.offsetHeight;
if (h - speed <= 0 ) {
obj.style.display = " none " ;
clearInterval(intervalID_Min);
}
else {
obj.style.height = (h - speed) + " px " ;
}
}
intervalID_Min = setInterval(strechH, 2 );
}
function toMaxBox(obj) {
obj.style.display = " block " ;
var speed = 10 ;
var originalHeight = ! obj.childNodes[ 0 ].offsetHeight ? obj.getElementsByTagName( " ul " )[ 0 ].offsetHeight : obj.childNodes[ 0 ].offsetHeight;
function strechM() {
var h = obj.offsetHeight;
if (h >= originalHeight) {
clearInterval(intervalID_Max);
}
else {
obj.style.height = (h + speed) + " px " ;
}
}
intervalID_Max = setInterval(strechM, 2 );
}