JQuery slides in different directions (such as horizontal slides) and jquery slides
Introduce jquery. js and copy the following code to run it.
Css code
- <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 () Alternate 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. Slide the Animate Left horizontally on the Left
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. Slide Animate Left Margin horizontally on the Left side (non-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(lelefty.css ('left'), 10) = 0? -$ Lefty. outerWidth (): 0
- });
- });
4. Slide to right on the right side
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(inclumarginlefty.css ('marginleft'), 10) = 0? $ Marginlefty. outerWidth (): 0
- });
- });
Principle of horizontal sliding of jquery special effect Images
Overflow = hidden;
Jquery plug-ins for horizontal page slide and jump
Www.oschina.net/project/tag/285/jquery-scroll. You can modify the code by yourself!