Mover Div
Mover div con un boton sin cola de animaciones con stop()
by Martin Miranda
HTML
<div id="container"></div>
<div id="button">Clickeame!!</div>
CSS
* {
box-sizing:border-box;
}
#container {
width:100px;
height:100px;
background-color:brown;
}
#button {
width:100px;
height:50px;
background-color:rgba(0, 150, 210, 1);
color:white;
margin-top:15px;
padding-top:15px;
border-radius:10px;
text-align:center;
font-family:Arial;
}
#button:hover {
cursor:pointer;
}
JavaScript
$(document).ready(function () {
$('#button').click(function () {
$('#container').stop().animate({
marginLeft: "+=50px"
}, 300);
});
});