Introduction of Jquery.js, copy the following code, you can run.
<style type= "Text/css" >
slide {
position:relative;
height:200;
Lightyellow
}
. Slide. Inner {
position:absolute;
left:0;
bottom:0;
height:100;
LightBlue;
width:100%
}
</style>
1, Slidetoggle () alternating slidedown (), Slideup ()
HTML code
<div id= "Slidebottom" class= "slide" >
<button>
slide It
</button>
<div class= "inner" >
Slide from bottom
</div>
</div>
JS Code
$ (' #slidebottom button '). Click (function () {
$ (this). Next (). Slidetoggle ();
});
2, left lateral alternating slide Animate
HTML code
<div id= "slidewidth" class= "slide" >
<button>
slide It
</button>
<div class= " Inner ">
Slide from bottom
</div>
</div>
JS Code
$ ("#slidewidth button"). Click (function () {
$ (this). Next (). Animate ({width: ' toggle '});
3, the left side of the alternate sliding slide Animate Margin (not hidden)
HTML code
<div id= "Slideleft" class= "slide" style= "Width:50%;float:right" >
<button>
Slide It
< /button>
<div class= "inner" >
Slide from bottom
</div>
</div>
JS Code
$ ("#slideleft button"). Click (function () {
var $lefty = $ (this). Next ();
$lefty. Animate ({
left:parseint ($lefty. css (' left '), "==0"-$lefty. Outerwidth (): 0
});
4, right lateral slide slide
HTML code
<div id= "Slidemarginleft" class= "slide" style= "Width:60%;float:left" >
<button>
Slide It
</button>
<div class= "inner" >
Slide from bottom
</div>
</div>
JS Code
$ ("#slidemarginleft button"). Click (function () {
var $marginlefty = $ (this). Next ();
$marginlefty. Animate ({
marginleft:parseint ($marginlefty. css (' marginleft ') ==0? $marginlefty. Outerwidth ( ): 0
});