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 }); });