JQuery slides in different directions (such as horizontal slides) and jquery slides

Source: Internet
Author: User

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  
  1. <Style type = "text/css">
  2. . Slide {
  3. Position: relative;
  4. Height: 200;
  5. Lightyellow;
  6. }
  7. . Slide. inner {
  8. Position: absolute;
  9. Left: 0;
  10. Bottom: 0;
  11. Height: 100;
  12. Lightblue;
  13. Width: 100%
  14. }
  15. </Style>

 

1. slidetoggle () Alternate slidedown (), slideup ()

 

Html code  
  1. <Div id = "slidebottom" class = "slide">
  2. <Button>
  3. Slide it
  4. </Button>
  5. <Div class = "inner">
  6. Slide from bottom
  7. </Div>
  8. </Div>

 

Js Code  
  1. $ ('# Slidebottom button'). click (function (){
  2. $ (This). next (). slideToggle ();
  3. });

 

 

2. Slide the Animate Left horizontally on the Left

 

Html code  
  1. <Div id = "slidewidth" class = "slide">
  2. <Button>
  3. Slide it
  4. </Button>
  5. <Div class = "inner">
  6. Slide from bottom
  7. </Div>
  8. </Div>

 

Js Code  
  1. $ ("# Slidewidth button"). click (function (){
  2. $ (This). next (). animate ({width: 'toggle '});
  3. });

 

3. Slide Animate Left Margin horizontally on the Left side (non-hidden)

 

Html code  
  1. <Div id = "slideleft" class = "slide" style = "width: 50%; float: right">
  2. <Button>
  3. Slide it
  4. </Button>
  5. <Div class = "inner">
  6. Slide from bottom
  7. </Div>
  8. </Div>

 

Js Code  
  1. $ ("# Slideleft button"). click (function (){
  2. Var $ lefty = $ (this). next ();
  3. $ Lefty. animate ({
  4. Left: parseint(lelefty.css ('left'), 10) = 0? -$ Lefty. outerWidth (): 0
  5. });
  6. });
 

 

4. Slide to right on the right side

 

Html code  
  1. <Div id = "slidemarginleft" class = "slide" style = "width: 60%; float: left">
  2. <Button>
  3. Slide it
  4. </Button>
  5. <Div class = "inner">
  6. Slide from bottom
  7. </Div>
  8. </Div>

Js Code  
  1. $ ("# Slidemarginleft button"). click (function (){
  2. Var $ marginlefty = $ (this). next ();
  3. $ Marginlefty. animate ({
  4. MarginLeft: parseint(inclumarginlefty.css ('marginleft'), 10) = 0? $ Marginlefty. outerWidth (): 0
  5. });
  6. });
 

 

 
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!
 

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.