Sliding in different directions (sliding left or right) controlled by jQuery _ jquery

Source: Internet
Author: User
This article mainly describes how to slide jQuery in different directions (sliding left and right). If you need it, refer to introduce jquery. js and copy the following code to run it.

 

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

Html code

slide it

Slide from bottom

Js Code

$('#slidebottom button').click(function() { $(this).next().slideToggle(); });

2. Slide the Animate Left horizontally on the Left

Html code

slide it

Slide from bottom

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

slide it

Slide from bottom

Js Code

$("#slideleft button").click(function(){ var $lefty = $(this).next(); $lefty.animate({ left:parseInt($lefty.css('left'),10)==0 ? -$lefty.outerWidth() : 0 }); });

4. Slide to right on the right side

Html code

slide it

Slide from bottom

Js Code

$("#slidemarginleft button").click(function(){ var $marginlefty = $(this).next(); $marginlefty.animate({ marginLeft:parseInt($marginlefty.css('marginLeft'),10)==0 ? $marginlefty.outerWidth() : 0 }); });
Related Article

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.