0
我一直在試圖找到一個更優雅的方式來做這個功能,但還沒有搞清楚。我有2個div,我想調整一個函數的執行時間。一個會滑開(寬度:'0%'),另一個填充剩餘空間(寬度:'100%')。下面的代碼工作很好,但似乎有點沉重。任何建議使其更清潔?使用Jquery Animate調整2x div寬度 - 這是一個糟糕的方法嗎?
function testAct(){
$('#sideBar').animate({width:'0%'},500);
$('#map_canvas').animate({width:'100%'},500,function(){google.maps.event.trigger(map,'resize')});
if (document.getElementById('map_canvas').style.width == '100%')
{
$('#sideBar').animate({width:'25%'},500);
$('#map_canvas').animate({width:'75%'},500,function(){google.maps.event.trigger(map,'resize')});
}
}
你應該考慮回到你以前的問題,選擇最佳答案,因爲接受的答案。 – 2012-01-17 22:16:36
四個'.animate()'調用中的兩個不指定持續時間。 – Jasper 2012-01-17 22:19:20
謝謝..我現在爲我的問題選擇最佳答案。我錯過了那個細節。我是新來stackoverflow – snowgage 2012-01-17 22:34:14