引入jquery.js,复制以下代码,即可运行。
1、slidetoggle() 交替slidedown(),slideup()
html代码
slide it slide from bottom
js代码
$('#slidebottom button').click(function() { $(this).next().slidetoggle(); });
2、左侧横向交替滑动 animate left
html代码
slide it slide from bottom
js代码
$(#slidewidth button).click(function(){ $(this).next().animate({width: 'toggle'}); });
3、左侧横向交替滑动 animate left margin (非隐藏)
html代码
slide it slide from bottom
js代码
$(#slideleft button).click(function(){ var $lefty = $(this).next(); $lefty.animate({ left:parseint($lefty.css('left'),10)==0 ? -$lefty.outerwidth() : 0 }); });
4、右侧横向滑动slide to right
html代码
slide it slide from bottom
js代码
$(#slidemarginleft button).click(function(){ var $marginlefty = $(this).next(); $marginlefty.animate({ marginleft:parseint($marginlefty.css('marginleft'),10)==0 ? $marginlefty.outerwidth() : 0 }); });
