Skip to content

Commit 62414a2

Browse files
author
Maksumi Muralami
committed
Traducción del articulo y las tareas
1 parent 2b61275 commit 62414a2

11 files changed

Lines changed: 51 additions & 51 deletions

File tree

2-ui/2-events/01-introduction-browser-events/05-sliding-menu/solution.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
# HTML/CSS
3-
First let's create HTML/CSS.
3+
Primero hay que crear el HTML y CSS.
44

5-
A menu is a standalone graphical component on the page, so it's better to put it into a single DOM element.
5+
Un menú es un componente gráfico independiente en la página, por lo que es mejor colocarlo en un solo elemento del DOM.
66

7-
A list of menu items can be laid out as a list `ul/li`.
7+
Una lista de elementos del menú se puede diseñar como una lista `ul/li`.
88

9-
Here's the example structure:
9+
Aquí está la estructura de ejemplo:
1010

1111
```html
1212
<div class="menu">
@@ -19,29 +19,29 @@ Here's the example structure:
1919
</div>
2020
```
2121

22-
We use `<span>` for the title, because `<div>` has an implicit `display:block` on it, and it will occupy 100% of the horizontal width.
22+
Usamos `<span>` para el título, porque `<div>` tiene un `display:block` implícito en él, y va a ocupar 100% del ancho horizontal.
2323

24-
Like this:
24+
Así:
2525

2626
```html autorun height=50
2727
<div style="border: solid red 1px" onclick="alert(1)">Sweeties (click me)!</div>
2828
```
2929

30-
So if we set `onclick` on it, then it will catch clicks to the right of the text.
30+
Entonces si establecemos `onclick` en él, detectará los clics a la derecha del texto.
3131

32-
As `<span>` has an implicit `display: inline`, it occupies exactly enough place to fit all the text:
32+
Como `<span>` tiene un `display: inline` implícito, ocupa exactamente el lugar suficiente para que quepa todo el texto:
3333

3434
```html autorun height=50
3535
<span style="border: solid red 1px" onclick="alert(1)">Sweeties (click me)!</span>
3636
```
3737

38-
# Toggling the menu
38+
# Alternar el menú
3939

40-
Toggling the menu should change the arrow and show/hide the menu list.
40+
Alternar el menú debería cambiar la flecha y mostrar/ocultar la lista del menú.
4141

42-
All these changes are perfectly handled by CSS. In JavaScript we should label the current state of the menu by adding/removing the class `.open`.
42+
Todos estos cambios son perfectamente controlados con CSS. En JavaScript debemos etiquetar el estado actual del menú agregando/eliminando la clase `.open`.
4343

44-
Without it, the menu will be closed:
44+
Sin él, el menú se cerrará:
4545

4646
```css
4747
.menu ul {
@@ -58,7 +58,7 @@ Without it, the menu will be closed:
5858
}
5959
```
6060

61-
...And with `.open` the arrow changes and the list shows up:
61+
...Y con `.open` la flecha cambia y aparece la lista:
6262

6363
```css
6464
.menu.open .title::before {

2-ui/2-events/01-introduction-browser-events/05-sliding-menu/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ importance: 5
22

33
---
44

5-
# Create a sliding menu
5+
# Crear un menú deslizante
66

7-
Create a menu that opens/collapses on click:
7+
Crea un menú que se abra/colapse al hacer click:
88

99
[iframe border=1 height=100 src="solution"]
1010

11-
P.S. HTML/CSS of the source document is to be modified.
11+
P.D. El HTML/CSS del documento fuente se debe modificar.

2-ui/2-events/01-introduction-browser-events/06-hide-message/solution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

2-
To add the button we can use either `position:absolute` (and make the pane `position:relative`) or `float:right`. The `float:right` has the benefit that the button never overlaps the text, but `position:absolute` gives more freedom. So the choice is yours.
2+
Para agregar el botón podemos usar cualquiera de las opciones `position:absolute` y hacer el pane `position:relative`) o `float:right`. El `float:right` tiene la ventaja de que el botón no se encima con el texto, pero `position:absolute` da más libertad. Entonces la elección es tuya.
33

4-
Then for each pane the code can be like:
4+
Luego, para cada panel, el código puede ser así:
55
```js
66
pane.insertAdjacentHTML("afterbegin", '<button class="remove-button">[x]</button>');
77
```
88

9-
Then the `<button>` becomes `pane.firstChild`, so we can add a handler to it like this:
9+
Luego el `<button>` se convierte en `pane.firstChild`, por lo que podemos agregarle un controlador como este:
1010

1111
```js
1212
pane.firstChild.onclick = () => pane.remove();

2-ui/2-events/01-introduction-browser-events/06-hide-message/solution.view/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ <h3>Cat</h3>
3030

3131
for(let pane of panes) {
3232
pane.insertAdjacentHTML("afterbegin", '<button class="remove-button">[x]</button>');
33-
// button becomes the first child of pane
33+
// button debe convertirse en el primer child de pane
3434
pane.firstChild.onclick = () => pane.remove();
3535
}
3636
</script>

2-ui/2-events/01-introduction-browser-events/06-hide-message/task.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ importance: 5
22

33
---
44

5-
# Add a closing button
5+
# Agregar un botón de cierre
66

7-
There's a list of messages.
7+
Hay una lista de mensajes.
88

9-
Use JavaScript to add a closing button to the right-upper corner of each message.
9+
Usa JavaScript para agregar un botón de cierre en la esquina superior derecha de cada mensaje.
1010

11-
The result should look like this:
11+
El resultado debería verse algo así:
1212

1313
[iframe src="solution" height=450]
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
The images ribbon can be represented as `ul/li` list of images `<img>`.
1+
La cinta de imágenes se puede representar como una lista `ul/li` de imágenes `<img>`.
22

3-
Normally, such a ribbon is wide, but we put a fixed-size `<div>` around to "cut" it, so that only a part of the ribbon is visible:
3+
Normalmente dicha cinta es ancha pero colocamos un tamaño fijo `<div>` alrededor para "cortarla", de modo que solo una parte de la cinta sea visible:
44

55
![](carousel1.svg)
66

7-
To make the list show horizontally we need to apply correct CSS properties for `<li>`, like `display: inline-block`.
7+
Para que la lista se muestre horizontalmente debemos aplicar las propiedades CSS correctas para `<li>`, como `display: inline-block`.
88

9-
For `<img>` we should also adjust `display`, because by default it's `inline`. There's extra space reserved under `inline` elements for "letter tails", so we can use `display:block` to remove it.
9+
Para `<img>` también deberíamos ajustar `display`, ya que es `inline` por default. Hay espacio adicional reservado debajo de los "letter tails", por lo que podemos usar `display:block` para eliminarlo.
1010

11-
To do the scrolling, we can shift `<ul>`. There are many ways to do it, for instance by changing `margin-left` or (better performance) use `transform: translateX()`:
11+
Para hacer el desplazamiento, podemos cambiar `<ul>`. Hay muchas formas de hacerlo, por ejemplo, cambiando `margin-left` o (para mejor rendimiento) usando `transform: translateX()`:
1212

1313
![](carousel2.svg)
1414

15-
The outer `<div>` has a fixed width, so "extra" images are cut.
15+
El `<div>` exterior tiene un ancho fijo, por lo que se cortan las imágenes "extra".
1616

17-
The whole carousel is a self-contained "graphical component" on the page, so we'd better wrap it into a single `<div class="carousel">` and style things inside it.
17+
Todo el carrusel es un "componente gráfico" autónomo en la página, por lo que será mejor que lo envuelva en un solo elemento `<div class="carousel">` y le apliquemos estilo.

2-ui/2-events/01-introduction-browser-events/07-carousel/solution.view/index.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,35 @@
2727
</div>
2828

2929
<script>
30-
/* label the images, just for convenience, to visually track them */
30+
/* etiqueta las imágenes pra poder rastrearlas, solo por conveniencia */
3131
let i = 1;
3232
for(let li of carousel.querySelectorAll('li')) {
3333
li.style.position = 'relative';
3434
li.insertAdjacentHTML('beforeend', `<span style="position:absolute;left:0;top:0">${i}</span>`);
3535
i++;
3636
}
3737

38-
/* configuration */
39-
let width = 130; // image width
40-
let count = 3; // visible images count
38+
/* configuración */
39+
let width = 130; // ancho de las imágenes
40+
let count = 3; // conteo de las imágenes visibles
4141

4242
let list = carousel.querySelector('ul');
4343
let listElems = carousel.querySelectorAll('li');
4444

45-
let position = 0; // ribbon scroll position
45+
let position = 0; // posición del desplazamiento del carrete
4646

4747
carousel.querySelector('.prev').onclick = function() {
48-
// shift left
48+
// desplazamiento izquierdo
4949
position += width * count;
50-
// can't move to the left too much, end of images
50+
// no podemos mover demasiado a la izquierda, se acaban las imágenes
5151
position = Math.min(position, 0)
5252
list.style.marginLeft = position + 'px';
5353
};
5454

5555
carousel.querySelector('.next').onclick = function() {
56-
// shift right
56+
// desplazamiento derecho
5757
position -= width * count;
58-
// can only shift the ribbbon for (total ribbon length - visible count) images
58+
// solo se puede desplazar el carrete de imágenes (longitud total de la cinta - conteo visibles)
5959
position = Math.max(position, -width * (listElems.length - count));
6060
list.style.marginLeft = position + 'px';
6161
};

2-ui/2-events/01-introduction-browser-events/07-carousel/solution.view/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ body {
1414
.carousel img {
1515
width: 130px;
1616
height: 130px;
17-
/* make it block to remove space around images */
17+
/* establecer block para remover el espacio alrededor de las imágenes */
1818
display: block;
1919
}
2020

@@ -60,7 +60,7 @@ body {
6060
padding: 0;
6161
list-style: none;
6262
transition: margin-left 250ms;
63-
/* remove white-space between inline-block'ed li */
63+
/* eliminando los espacios en blanco entre los li inline-block'ed */
6464
/* http://davidwalsh.name/remove-whitespace-inline-block */
6565
font-size: 0;
6666
}

2-ui/2-events/01-introduction-browser-events/07-carousel/source.view/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828

2929

3030
<script>
31-
// label the images to visually track them, just for convenience,
32-
// this code can be removed
31+
// etiqueta las imágenes pra poder rastrearlas, solo por conveniencia,
32+
// este código puede ser removido
3333
let i = 1;
3434
for(let li of carousel.querySelectorAll('li')) {
3535
li.style.position = 'relative';
3636
li.insertAdjacentHTML('beforeend', `<span style="position:absolute;left:0;top:0">${i}</span>`);
3737
i++;
3838
}
3939

40-
// ...your code to make carousel alive!
40+
// ...¡Tu código para crear un carrusel con vida!
4141
</script>
4242

4343
</body>

2-ui/2-events/01-introduction-browser-events/07-carousel/source.view/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ ul {
3030
ul img {
3131
width: 130px;
3232
height: 130px;
33-
display: block; /* removes extra space near images */
33+
display: block; /* remueve el espacio extra cerca de las imágenes */
3434
}
3535

3636
ul li {
37-
display: inline-block; /* removes extra space between list items
37+
display: inline-block; /* remueve el espacio extra entre los elementos li
3838
}

0 commit comments

Comments
 (0)