I am trying to create a function that lets me move elements around with a timing effect. Here I am using the .insertBefore
and .insertAfter
with 2 buttons to move DIV's up and down.
I would like to know if it is possible to use the .animate
effect here to set a timing effect while the DIV's move from one place to another.
Cheers
function moveup(mover){
if($(mover).parent().prev().is('div'))
$(mover).parent().insertBefore($(mover).parent().prev());
}
function movedown(mover){
if($(mover).parent().next().is('div'))
$(mover).parent().insertAfter($(mover).parent().next());
}