-
Notifications
You must be signed in to change notification settings - Fork 0
/
ejercicio_5_19.html
205 lines (169 loc) · 7.83 KB
/
ejercicio_5_19.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ejercicio 5 19</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- Estilos de la master -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="lib/estilo5_19.css">
<!-- Estilos de los recursos adicionales -->
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary nav-pills nav-justified">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#barradenavegacion"
aria-controls="barradenavegacion" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <a>Lista de Ejemplos</a>
</button>
<div class="collapse navbar-collapse collapse" id="barradenavegacion">
<ul class="navbar-nav navbar-nav nav-fill w-100">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
1.- Selección
</a>
<div class="dropdown-menu" aria-labelledby="dropdown08">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
2.- DOM
</a>
<div class="dropdown-menu" aria-labelledby="dropdown08">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
3.- Eventos
</a>
<div class="dropdown-menu" aria-labelledby="dropdown08">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
4.- DOM
</a>
<div class="dropdown-menu" aria-labelledby="dropdown08">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
5.- Animaciones
</a>
<div class="dropdown-menu" aria-labelledby="dropdown08">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
6.- AJAX
</a>
<div class="dropdown-menu" aria-labelledby="dropdown08">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
7.- Formularios
</a>
<div class="dropdown-menu" aria-labelledby="dropdown08">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
</ul>
</div>
</nav>
<div class="jumbotron">
<div class="container">
<h1 class="display-3">5.- Animaciones y Efectos</h1>
<div
class="card-body d-flex border rounded-sm shadow-sm justify-content-between align-items-center bg-light text-dark">
Ejercicio 19 -> Ocultar o Mostrar Elementos
<a href="index.html" class="btn btn-success btn-lg ml-auto">Ir a Página Principal</a>
</div>
</div>
</div>
<!-- Editar desde aquí -->
<p>En el siguiente código html realizamos manipulación del DOM:</p>
<div class="row">
<div class="col-md-4">
<p>Formulario a:</p>
<div class="row">
<div id="fondorow" class="col-md-12">
<div class="item-box-tarjeta col-md-8" data-price="199">
<img src="lib/images/image.png" />
<div class="item-title">Bahía Inglesa</div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<div class="item-price">$199</div>
<button>Add to cart</button>
<div>
<a href="#" class="info-link">More info</a>
</div>
<div class="more-info">
<p>Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem</p>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-8">
<p>Codigo Javascript:</p>
<pre class="p-3 mb-2 bg-dark text-white"><code>$(document).ready(function () {
$('.item-box-tarjeta').on('click', 'a.info-link', function(event){
event.preventDefault();
//Show -> muestra
//Hide -> Oculta
//toggle -> muestra u oculta
$(this).closest('.item-box-tarjeta').find('.more-info').toggle(1000, function(){
//alert('Se completo!');
});
});
});</code></pre>
<p>Codigo CSS:</p>
<pre class="p-2 mb-1 bg-info text-white"><code>#fondorow { font-family: arial; background-color: #9B50AF; }
header { height: 40px; padding-right:30px; background-color: black; line-height: 40px; vertical-align: center; text-align: right; }
header a { text-decoration: none; color: white; }
.item-box-tarjeta { width: 200px; margin: 20px; min-height: 200px; float: left; background-color: #3BEAB4; padding: 20px; }
.item-title { margin: 10px 0px; }
.item-box p { font-size: 8pt; color: #6F6F6E; }
.item-price { margin: 10px 0px; }
.info-link { font-size: 10pt; }
.more-info { margin-top: 20px; display: none; }
button { background-color: #E17BBA; color: white; font-weight: bold; border:none; padding: 5px; }</code></pre>
</div>
</div>
<!-- Hasta aquí modificaremos -->
</div>
<!-- Librerías adicionales -->
<script src="lib/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- Librerías de plugins -->
<!-- Archivo personalizado de Javascript -->
<script src="lib/ejercicio5_19.js"></script>
</body>
</html>