हालांकि Azatoth द्वारा जवाब ठीक काम करता है, बॉबी, एक एनीमेशन की तलाश में हो सकता है की तरह मैंने किया था।
function moveUp(item) {
var prev = item.prev();
if (prev.length == 0)
return;
prev.css('z-index', 999).css('position','relative').animate({ top: item.height() }, 250);
item.css('z-index', 1000).css('position', 'relative').animate({ top: '-' + prev.height() }, 300, function() {
prev.css('z-index', '').css('top', '').css('position', '');
item.css('z-index', '').css('top', '').css('position', '');
item.insertBefore(prev);
});
}
function moveDown(item) {
var next = item.next();
if (next.length == 0)
return;
next.css('z-index', 999).css('position', 'relative').animate({ top: '-' + item.height() }, 250);
item.css('z-index', 1000).css('position', 'relative').animate({ top: next.height() }, 300, function() {
next.css('z-index', '').css('top', '').css('position', '');
item.css('z-index', '').css('top', '').css('position', '');
item.insertAfter(next);
});
}
आप अगर किसी को हर रिकॉर्ड वह क्या कर सकते हैं के लिए बटन को लेना पसंद है, यहाँ में http://jsfiddle.net/maziar/P2XDc/
स्रोत
2013-05-16 08:41:39
दूसरा जवाब उत्कृष्ट है। पहला जवाब भी अच्छा है। आपने स्वीकार क्यों नहीं किया? –