Q
旋轉列表項
1
A
回答
1
分給按鈕兩類.up
和.down
並附加事件
working version on fiddle here或here
$(".up").click(function(){
$("ul li:first").slideUp('slow', function() {
$("ul li:last").after($(this));
}).slideDown('slow');
});
$(".down").click(function(){
$("ul li:last").slideUp('slow', function() {
$("ul li:first").before($(this));
}).slideDown('slow');
});
+0
謝謝,它工作完美 – metur 2011-03-23 17:12:11
1
這聽起來像你想控制列表的旋轉方向。 如果是的話,試試這個:
var direction = 'down';
$(document).ready(function() {
var swap = function() {
if (direction == 'down') {
$("ul li:last").slideUp('slow', function() {
$(this).remove();
$("ul").prepend($(this));
$(this).slideDown('slow', function() {
swap();
});
});
}
else {
$("ul li:first").slideDown('slow', function() {
$(this).remove();
$("ul").append($(this));
$(this).slideUp('slow', function() {
swap();
});
});
}
}
swap();
});
然後所有的按鍵需要做的是改變「方向」的值,例如
onclick="direction = 'up';"
+0
感謝您的回覆,我還沒有嘗試上面的代碼,但它確實看起來接近我正在尋找的東西。 :) – metur 2011-03-23 17:17:31
相關問題
- 1. 如何旋轉表的列項列
- 2. 播放列表中的項目旋轉
- 3. 將列表項目旋轉90度
- 4. JQuery旋轉列表
- 5. Python列表旋轉
- 6. 旋轉列表位置
- 7. 列名和旋轉表
- 8. OCaml中的旋轉列表
- 9. Haskell中的列表旋轉
- 10. 旋轉鏈接列表C
- 11. QML排列項目與旋轉
- 12. SSRS:旋轉列
- 13. 旋轉圖像。動畫列表還是動畫旋轉? (Android)
- 14. 將1000列旋轉/旋轉到行
- 15. 比較旋轉的列表,包含重複項
- 16. jQuery通過畫廊中的列表項旋轉
- 17. 旋轉正在裁剪圖層列表項目
- 18. 在CSS中旋轉列表項90度行爲奇怪
- 19. 旋轉SQL表
- 20. 旋轉SQL表
- 21. Java - 旋轉陣列
- 22. 旋轉員工列
- 23. 旋轉關於索引的列表
- 24. 在列表中旋轉值[Python]
- 25. SQL:旋轉兩個文本列表?
- 26. Python 3中的左側列表旋轉
- 27. 旋轉和平移顯示列表
- 28. 如何旋轉這個對象列表?
- 29. 手機旋轉時列表消失(Android)
- 30. 列表中元素的旋轉
有啥你的問題? – sharpner 2011-03-23 12:01:56
所以你想要選擇一個列表項目以移動? – 2011-03-23 12:01:56
從本質上講,我的問題是我如何在代碼中包含兩個按鈕。第一個按鈕,單擊時應允許列表向下滾動,而第二個按鈕,單擊時應允許列表向上滾動。 – metur 2011-03-23 12:08:25