大佬教程收集整理的这篇文章主要介绍了jquery – 当div移动以填充淡出的其他div留下的空白空间时,如何为div设置动画,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
如何在其他人消失并留下空白空间之后平滑未隐藏的div的移动?
//Before this goes a long function that decides wich divs will get their class changed $('#work-container > div[class*=visible]').fadeIn('slow','swing'); $('#work-container > div[class*=hidden]').fadeOut('slow','swing');
编辑:http://jsfiddle.net/Ccswn/3/小提琴的东西
$('div').click( function() { $(this).animate({ 'height': 0,'opacity': 0 },750,function() { $(this).remove(); }); });
编辑以合并jQuery / CSS解决方案:
更改.item的CSS以包含以下内容:
.item{ /* other css removed for brevity */ -webkit-transition: all 1s linear; -moz-transition: all 1s linear; -o-transition: all 1s linear; -ms-transition: all 1s linear; transition: all 1s linear; }
并将a.hidden更改为以下内容:
.hidden { width: 0; /* reset everything that might affect the size/visibility */ height: 0; padding: 0; margin: 0; opacity: 0; -webkit-transition: all 1s linear; -moz-transition: all 1s linear; -o-transition: all 1s linear; -ms-transition: all 1s linear; transition: all 1s linear; }
使用以下jQuery:
// content animate $('#work-container > div[class*=hidden]').addClass('hidden'); return false;
然后一切似乎都按照你的意愿运作.虽然我没有尝试按照上面的块中的.addClass(‘visible’)进行操作,但我还是不管它.
以上是大佬教程为你收集整理的jquery – 当div移动以填充淡出的其他div留下的空白空间时,如何为div设置动画全部内容,希望文章能够帮你解决jquery – 当div移动以填充淡出的其他div留下的空白空间时,如何为div设置动画所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。