0
Slide right to left?可摺疊/滑動「托盤」(DIV)
http://www.learningjquery.com/2009/02/slide-elements-in-different-directions
我一直在上面之間跳轉試圖讓我的「托盤」的工作無濟於事。部分問題是我不希望其中一個div完全消失。我想要一個「托盤」,一個長矩形,點擊後會滑出包含名稱的div。現在我把它設置爲反向,但我無法弄清楚如何讓擴展爲默認隱藏的div(*我也不明白爲什麼它們是不同的顏色,但具有相同的CSS)。
HTML:
<div class ="collapsedTray">
<div class="expandTray">
Joey Joe Joe Jr.</br>
Tommy Thompson Thomas III</br>
Stephen Stephenson </br>
Cool Mo Dee Tomahawk Fire Marshall Bill</br>
</div>
CSS:
.collapsedTray {
width:10px;
height: 500px;
background:grey;
opacity:0.5;
position: absolute;
left:0;
}
.expandTray {
white-space: nowrap;
height: 500px;
background:grey;
opacity:0.5;
position: absolute;
left:0;
padding:8px;
}
Y:
$('.collapsedTray').click(function(){
var $lefty = $('.expandTray');
$lefty.animate({
left: parseInt($lefty.css('left'),10) == 0 ?
-$lefty.outerWidth() :
0
});
});
完美。謝謝。 – Lorenzo 2013-04-03 19:02:06