Using timeout plugin from : http://benalman.com/projects/jquery-dotimeout-plugin/
HTML :
<button>Rotate</button>
<div id="announc">
<table>
<tbody>
<tr><td>header</td></tr>
<tr><td>Item 1</td></tr>
<tr><td>Item 2</td></tr>
<tr><td>Item 3</td></tr>
<tr><td>Item 4</td></tr>
<tr><td>Item 5</td></tr>
</tbody>
</table>
</div>
<table>
<tbody>
<tr><td>header</td></tr>
<tr><td>Item 1</td></tr>
<tr><td>Item 2</td></tr>
<tr><td>Item 3</td></tr>
<tr><td>Item 4</td></tr>
<tr><td>Item 5</td></tr>
</tbody>
</table>
</div>
Scripting :
$("button").click(function(){
var len = $('#announc tr').length;
var $first = $('#announc tr').eq(1).closest('tr');
var $last = $('#announc tr').eq(len-1).closest('tr');
$last.insertBefore($first);
});
var len = $('#announc tr').length;
var $first = $('#announc tr').eq(1).closest('tr');
var $last = $('#announc tr').eq(len-1).closest('tr');
$last.insertBefore($first);
});
$.doTimeout( 1000, function(){
var len = $('#announc tr').length;
var $first = $('#announc tr').eq(1).closest('tr');
var $last = $('#announc tr').eq(len-1).closest('tr');
$last.insertBefore($first);
return true;
});
var len = $('#announc tr').length;
var $first = $('#announc tr').eq(1).closest('tr');
var $last = $('#announc tr').eq(len-1).closest('tr');
$last.insertBefore($first);
return true;
});
No comments:
Post a Comment