I'm having trouble figuring out callbacks, or whatever this is. I'm using some jquery addon called easing and what is supposed to happen is you click a button, and a div flies in from the left, then when you click on the x on that div, it flies out the right. Problem is, when you click it again it flies in from the right and out the right. What I want to do is have the div appear back at its original position when the animation finishes playing.
<script>
$(document).ready(function() {
$('#button').click(function(event) {
$('#animdiv')
.animate(
{ left: 170 }, {
duration: 'slow',
easing: 'easeOutBack'
});
});
$('#exit').click(function(event) {
$('#animdiv')
.animate(
{ left: 1200 }, {
duration: 'slow',
easing: 'easeOutBack'
});
});
});
// this is the function that takes it back to it's original place
function placeDiv(x_pos, y_pos) {
var d = document.getElementById('animdiv');
d.style.position = "absolute";
d.style.left = -600;
d.style.top = 32;
}
</script>