function baja(){
$('#elDiv').animate({marginTop: '500px'}, {complete: sube});
}
function sube(){
$('#elDiv').animate({marginTop: '0px'}, {complete: baja});
}
$('#boton').on('click', baja);
Alecs7k escribió:Gracias, funciona parcialmente. Baja pero no vuelve a subir, ya arreglaré yo esto. Al probar con animate use margin-top en vez de maginTop.
<html>
<head>
<title></title>
</head>
<body>
<input id="boton" type="submit" value="animate" />
<div id="elDiv" style="background:blue; height:100px;"></div>
</body>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
function baja(){
$('#elDiv').animate({marginTop: '500px'}, {complete: sube});
}
function sube(){
$('#elDiv').animate({marginTop: '0px'}, {complete: baja});
}
$('#boton').on('click', baja);
</script>
</html>
Alecs7k escribió:Gracias, funciona parcialmente. Baja pero no vuelve a subir, ya arreglaré yo esto. Al probar con animate use margin-top en vez de maginTop.
function baja(){
$('#todo').animate({marginTop: '500px'}, 2000);
sube();
};
function sube(){
$('#todo').animate({marginTop: '0px'}, 2000);
baja();
};