Special Effects | Web pages | Special effects need to write a sliding expansion of the effect of folding, search to worry-free script a post, slightly modified to make it in the FF can also be applied, the code is as follows: <script type= "Text/javascript" >
Url:http://bbs.51js.com/thread-61646-1-1.html
Author: Mutation
Modify: Maple Rock
Var Act;
function over (S,nmax) {
var Obj=document.getelementbyid (s);
var h = parseint (obj.offsetheight);
if (H < Nmax) {
Obj.style.height = (H + 2) + "px";
Cleartimeout (ACT);
act = settimeout ("Over (' +s+", "+nmax+") ", 10);
}
}
function out (s,nmin) {
var Obj=document.getelementbyid (s);
var h = parseint (obj.offsetheight);
if (H > Nmin) {
Obj.style.height = (h-2) + "px";
Cleartimeout (ACT);
act = settimeout ("Out" ("+s+", "+nmin+") ", 10);
}
}
</script>
<div id= "MYTD" style= "background: #eee;" > code example: Sliding expansion/folding of layers </div>
Worry-free netizen fangxiao9159 again after optimization:
<script type= "Text/javascript" >
var intervalid = null;
function Move (id,state) {
var obj = document.getElementById (ID);
if (intervalid!= null)
Window.clearinterval (Intervalid);
function Change () {
var h = parseint (obj.offsetheight);
Obj.style.height = (state = = "Down")? (H + 2): (h-2);
}
Intervalid = Window.setinterval (change,10);
}
</script>
<table border= "1" cellpadding= "0" cellspacing= "0" id= "MYTD" >
<tr><td> Worry-free script-mutation </td></tr></table>