-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjquery18-controlarEfectos.html
65 lines (59 loc) · 1.2 KB
/
jquery18-controlarEfectos.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Controlar efectos</title>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(document).on('ready',function(){
//ejemplo que muestra cómo controlar animaciones
//Ejemplo 1: metodo stop() en funcion pararAnim()
//definimos un time-out:
/*
var to=setTimeout('pararAnim()',2000);
$('#caja1').animate({
'margin-bottom':0
},5000,function(){
$('#caja1').animate({
'background-color':'#0FD',
'margin-top':-100,
'opacity':0.5
})
})
*/
//Ejemplo 2: método delay
//$('#caja1').slideUp().delay(2000).slideDown();
//Ejemplo 3: desactivar las animaciones colocando
//directamente los valores finales
// poner la siguiente linea al principio
//$.fx.off=true;
});
function pararAnim(){
$('#caja1').stop();
}
</script>
<style>
body,html{
padding:100px;
}
div
{
display:block;
height:80px;
width: 400px;
margin:0 auto;
}
#caja1{
background: rgba(56,56,56,0.8);
margin-bottom: 100px;
}
#caja2{
background: rgba(89,69,36,0.8);
}
</style>
</head>
<body>
<div id="caja1">Hola</div>
<div id="caja2">Hola</div>
</body>
</html>