0
我想讓圖像滑動到相應的單擊li上的中心位置。因此,例如,如果我在列表中單擊數字2,它將滑動到數字2.問題是知道用戶下一步單擊的位置,如何確定當前位置以及滑動方向。使用jquery按位置滑動圖像
這裏是我的html
<ul id="llist">
<li class="t current"><a href="#"><span>solutions</span></a><img src="images/bg-tab-leader-arrow.png" width="24" height="53" title="pointer" class="pointer" /></li>
<li class="m"><a href="#"><span>credit mangement solutions</span></a></li>
<li class="b"><a href="#"><span>third party additions</span></a></li>
</ul>
這是到目前爲止我的jquery:
$('#leader #llist li').click(function() {
$('.pointer').animate({'top':'+=61px'},1000,function() {
$(this).removeClass('current');
});
}, function() {
$('.pointer').animate({'top':'-=61px'},1000);
$(this).addClass('current');
});
任何幫助,將不勝感激。
甜,非常感謝馬文 – Andy 2010-12-10 10:52:06
是否有可能延長你的函數淡入淡出標籤?我知道這是一個不同的問題... – Andy 2010-12-10 10:52:59
只需在點擊處理程序內的適當選項卡上添加對fadeOut()的調用即可。 – 2010-12-10 10:56:17