当我点击绿色区域时,所有东西都会隐藏,但是绿色区域很卡顿,它通过一个不连贯的动作来到第一个绿色区域的旁边。有没有可能进行平滑的过渡,使它可以滑动并直接放在第一个绿色区域旁边?
JS代码:
$('.green').click(function(){
$('.others').fadeOut();
});
CSS:
.green{ background:green; padding:10px; margin:10px; }
.red{ background:red; padding:10px; margin:10px; }
.blue{ background:blue; padding:10px; margin:10px; }
.green:hover{ cursor:pointer;}
.fade{display:none; opacity:0;}
div{ float:left; }
HTML:
<div class="green"></div>
<div class="red others"></div>
<div class="blue others"></div>
<div class="green"></div>
<div class="red others"></div>
<div class="blue others"></div>
animate()
函数:https://api.jquery.com/animate/ - WASasquatch