Slide expand/Shrink AD Code instance effect

Source: Internet
Author: User
Tags setinterval window
Advertising function Description:
Sliding expansion/contraction advertising effect, you can specify: The full expansion of the ad when the stay time, the maximum height

Compatible Browsers:
ie5.0+, ff1.06+, opera8.0+

Instance code:
<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">
<title> code example: Sliding expansion/shrinking advertising </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<meta name= "Author" content= "Maple Rock, CNLei.y.l@gmail.com" >
<meta name= "keywords" content= "code instance: Sliding expansion/shrinking advertisement"/>
<script type= "Text/javascript" >
var intervalid = null;
function Slidead (id,nstaytime,sstate,nmaxhth,nminhth) {
this.staytime=nstaytime*1000 | | 3000;
this.maxheigth=nmaxhth | | 90;
this.minheigth=nminhth | | 1;
This.state=sstate | | "Down";
var obj = document.getElementById (ID);
if (intervalid!= null) window.clearinterval (intervalid);
function OpenBox () {
var h = obj.offsetheight;
Obj.style.height = ((This.state = = "Down")? (H + 2): (h-2)) + "px";
if (obj.offsetheight>this.maxheigth) {
Window.clearinterval (Intervalid);
Intervalid=window.setinterval (Closebox,this.staytime);
}
if (obj.offsetheight<this.minheigth) {
Window.clearinterval (Intervalid);
Obj.style.display= "None";
}
}
function CloseBox () {
Slidead (Id,this.staytime, "up", nmaxhth,nminhth);
}
Intervalid = Window.setinterval (openbox,10);
}
</script>
<body style= "MARGIN:0;PADDING:0;FONT-SIZE:14PX;" >
<div id= "Mymovead" style= "background: #ff0; height:12px;overflow:hidden;" >
<ul>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>


<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
</ul>
</div>
<p> Code Instance:<strong> slide Expand/Shrink advertisement </strong> Please refresh the page and watch the demo again </p>
<script type= "Text/javascript" >
<!--
Slidead (' Mymovead ', 2);
-->
</script>
</body>



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.