我想讓jquery水平地動畫一些長佈局,但似乎無法使其工作。我懷疑是一個遍歷問題,但嘗試了幾個小時,無法修復。請提前幫助和感謝。jquery遍歷
我試圖讓「innerlonglayout」水平滾動,點擊按鈕。
這裏是我的代碼:
<div id="innermask">
<div id="innerlonglayout">
<div class="container-bits">Content Here</div>
<div class="container-bits">Content Here</div>
<div class="container-bits">Content Here</div>
<div class="container-bits">Content Here</div>
<div class="container-bits">Content Here</div>
<div class="container-bits">Content Here</div>
</div>
</div>
<div class="boxmenu">
<span id="2002"><img src="images/butt_2002.png"></span>
<span id="2003"><img src="images/butt_2003.png"></span>
<span id="2004"><img src="images/butt_2004.png"></span>
<script>
$("#2002").click(function() {
$("#2002").parent().parent().parent().children().children().animate({position:'fixed',left:'30px'}, "slow");
});
$("#2003").click(function() {
$("#2002").parent().parent().children().children().animate({position:'fixed',left:'-300px'}, "slow");
});
$("#2004").click(function() {
$("#2002").parent().parent().children().children("#innerlonglayout").animate({position:'fixed',left:'-600px'}, "slow");
});
</script>
</div>
這裏是我的CSS:
#innermask{
width:500px;
height:250px;
border:1px solid #cc61b8;
overflow:hidden;
}
#innerlonglayout{
width:10000px; // just an example
}
.container-bits{
width:250px;
height:498px;
float:left;
}
你想完成什麼? – 2011-04-26 18:32:33
你確定你需要所有這些代碼嗎? ();'('position''fixed',left:' - 300px'},'slow');''''''''做一個更簡單的方法,它會讓你的代碼更易於理解。還要確保你的CSS是正確的,所有的'span'都在同一行上。試着在你的'#innermask'中運行沒有溢出:隱藏的程序 – 2011-04-26 18:57:02