[英]Div slideLeft.. Like slideDown or slideUp
我想用jquery来滑动一个div ..但是喜欢slideDown和slideUp或者slideToggle ..我该怎么办?
Here's a quick jQuery plugin that might help ? 这是一个可能有帮助的快速jQuery插件?
jQuery.fn.slideLeftHide = function( speed, callback ) {
this.animate({
width: "hide",
marginLeft: "hide",
marginRight: "hide"
}, speed, callback );
}
jQuery.fn.slideLeftShow = function( speed, callback ) {
this.animate( {
width: "show",
marginLeft: "show",
marginRight: "show"
}, speed, callback );
}
To be used like so: 要像这样使用:
$("#elemID").slideLeftHide(300);
Make an animation that use .animate()
to reduce the width to 0: 制作一个使用
.animate()
将宽度减小到0的动画:
$('#my-id').animate({ width : 0 }, 1000); // slide left the div
Slide right is more complicated... 向右滑动更复杂......
如果你的div有溢出:隐藏,这可以工作
$("#test").animate({width:0},500,function(){$(this).hide()})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.