Web effects: Sliding expansion and folding effect

Source: Internet
Author: User
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>

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.