I'm trying to simulate as if you were saving an item visually.
$(function(){
$(document).on('click','#save',function(){
$('#foo').animate({
left: '100%',
bottom: '0',
opacity: '0',
height: '0px',
width: '0px'
}, 'slow');
});
})
#foo{
height: 250px;
width: 25%;
background-color: cyan;
border: 1px solid black;
position: relative;
}
#bar{
position: absolute;
top: 1%;
right: 1%;
background-color: red;
height: 15px;
width: 10%;
color: white;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="foo">
mucha info
</div><br>
<input type="button" id="save" value="Guardar">
<div id="bar">
saved
</div>
The problem is that the div FOO disappears and I do not want that, I want it to be cloned and that cloned FOO does the effect, I do not want to lose the original but I do not get it, I tried to do it like this:
$('#foo').clone().animate({
left: '100%',
bottom: '0',
opacity: '0',
height: '0px',
width: '0px'
}, 'slow');
Thanks for your suggestions