diff --git a/2-ui/3-event-details/4-mouse-drag-and-drop/1-slider/solution.md b/2-ui/3-event-details/4-mouse-drag-and-drop/1-slider/solution.md index 6d8878d4a..7a30cf0ac 100644 --- a/2-ui/3-event-details/4-mouse-drag-and-drop/1-slider/solution.md +++ b/2-ui/3-event-details/4-mouse-drag-and-drop/1-slider/solution.md @@ -1,5 +1,5 @@ -As we can see from HTML/CSS, the slider is a `
` with a colored background, that contains a runner -- another `
` with `position:relative`. +Como podemos ver en el HTML/CSS, la barra de desplazamiento es un `
` con un fondo de color, que contiene un pasador: otro `
` con `position:relative`. -To position the runner we use `position:relative`, to provide the coordinates relative to its parent, here it's more convenient here than `position:absolute`. +Para posicionar el pasador usamos `position:relative`, para proveer las coordenadas relativas a su padre, aquí es más conveniente que `position:absolute`. -Then we implement horizontal-only Drag'n'Drop with limitation by width. +En este caso implementamos un Arrastrar y Soltar horizontal limitado por el ancho. diff --git a/2-ui/3-event-details/4-mouse-drag-and-drop/1-slider/task.md b/2-ui/3-event-details/4-mouse-drag-and-drop/1-slider/task.md index 0c6da4e2c..8f914be93 100644 --- a/2-ui/3-event-details/4-mouse-drag-and-drop/1-slider/task.md +++ b/2-ui/3-event-details/4-mouse-drag-and-drop/1-slider/task.md @@ -2,15 +2,15 @@ importance: 5 --- -# Slider +# Control deslizante -Create a slider: +Crea un control deslizante: [iframe src="solution" height=60 border=1] -Drag the blue thumb with the mouse and move it. +Arrastra el pasador azul con el ratón y muévelo. -Important details: +Detalles importantes: -- When the mouse button is pressed, during the dragging the mouse may go over or below the slider. The slider will still work (convenient for the user). -- If the mouse moves very fast to the left or to the right, the thumb should stop exactly at the edge. +- Cuando el botón del ratón es presionado, durante el arrastrado del ratón puedes ir por arriba o debajo de la barra deslizante. Ésta seguirá funcionando (es lo conveniente para el usuario). +- Si el ratón se mueve muy rápido hacia la izquierda o la derecha, el pasador se detiene exactamente en el borde. diff --git a/2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solution.md b/2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solution.md index 62cbdb9c5..1c87698da 100644 --- a/2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solution.md +++ b/2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solution.md @@ -1,5 +1,5 @@ -To drag the element we can use `position:fixed`, it makes coordinates easier to manage. At the end we should switch it back to `position:absolute` to lay the element into the document. +Para arrastrar el elemento podemos usar `position:fixed`, esto hace las coordenadas más fáciles de manejar. Al final deberíamos devolverla a `position:absolute` para fijar el elemento en el documento. -When coordinates are at window top/bottom, we use `window.scrollTo` to scroll it. +Cuando las coordinadas están en el tope/fondo de la ventana, usamos `window.scrollTo` para desplazarla. -More details in the code, in comments. +Más detalles en el código, en los comentarios. diff --git a/2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/task.md b/2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/task.md index 91fbaa0f2..b3008f79d 100644 --- a/2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/task.md +++ b/2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/task.md @@ -2,19 +2,19 @@ importance: 5 --- -# Drag superheroes around the field +# Arrastrar super héroes por el campo -This task can help you to check understanding of several aspects of Drag'n'Drop and DOM. +Esta tarea te puede ayudar a comprobar tu entendimiento de varios aspectos de Arrastrar y Soltar, y del DOM. -Make all elements with class `draggable` -- draggable. Like a ball in the chapter. +Hacer que todos los elementos con clase `draggable` sean arrastrables. Como la pelota de este capítulo. -Requirements: +Requerimientos: -- Use event delegation to track drag start: a single event handler on `document` for `mousedown`. -- If elements are dragged to top/bottom window edges -- the page scrolls up/down to allow further dragging. -- There is no horizontal scroll (this makes the task a bit simpler, adding it is easy). -- Draggable elements or their parts should never leave the window, even after swift mouse moves. +- Usa delegación de eventos para detectar el inicio del arrastrado: un solo manejador de eventos en el `document` para `mousedown`. +- Si los elementos son arrastrados a los bordes superior/inferior de la ventana: la página se desliza hacia arriba/abajo para permitir dicho arrastre. +- Sin desplazamiento horizontal (esto hace la tarea un poco más simple, añadirlo es fácil). +- Los elementos arrastrables o sus partes nunca deben dejar la ventana, incluso después de movimientos rápidos del ratón. -The demo is too big to fit it here, so here's the link. +La demostración es demasiado grande para caber aquí, así que aquí está el enlace. [demo src="solution"] diff --git a/2-ui/4-forms-controls/1-form-elements/1-add-select-option/solution.md b/2-ui/4-forms-controls/1-form-elements/1-add-select-option/solution.md index 80fad3850..7cd78466f 100644 --- a/2-ui/4-forms-controls/1-form-elements/1-add-select-option/solution.md +++ b/2-ui/4-forms-controls/1-form-elements/1-add-select-option/solution.md @@ -1,4 +1,4 @@ -The solution, step by step: +La solución, paso a paso: ```html run `: +Tenemos un ` @@ -13,10 +13,10 @@ There's a ` ``` -Use JavaScript to: +Utiliza JavaScript para: -1. Show the value and the text of the selected option. -2. Add an option: ``. -3. Make it selected. +1. Mosrar el valor y el texto del option seleccionado. +2. Añadir un option: ``. +3. Seleccionarlo. -Note, if you've done everything right, your alert should show `blues`. +Nota, si haz hecho todo bien, tu alert debería mostrar `blues`. diff --git a/2-ui/4-forms-controls/1-form-elements/article.md b/2-ui/4-forms-controls/1-form-elements/article.md index 1c6188b5b..a6ce5056d 100644 --- a/2-ui/4-forms-controls/1-form-elements/article.md +++ b/2-ui/4-forms-controls/1-form-elements/article.md @@ -1,23 +1,23 @@ -# Form properties and methods +# Propiedades y Métodos de Formularios -Forms and control elements, such as `` have a lot of special properties and events. +Los formularios y controles, como ``, tienen muchos eventos y propiedades especiales. -Working with forms will be much more convenient when we learn them. +Trabajar con formularios será mucho más conveniente cuando los aprendamos. -## Navigation: form and elements +## Navegación: Formularios y elementos -Document forms are members of the special collection `document.forms`. +Los formularios del documento son miembros de la colección especial `document.forms`. -That's a so-called "named collection": it's both named and ordered. We can use both the name or the number in the document to get the form. +Esa es la llamada "Colección nombrada": es ambas cosas, nombrada y ordenada. Podemos usar el nombre o el número en el documento para conseguir el formulario. ```js no-beautify -document.forms.my - the form with name="my" -document.forms[0] - the first form in the document +document.forms.my - el formulario con name="my" +document.forms[0] - el primar formulario en el documento ``` -When we have a form, then any element is available in the named collection `form.elements`. +Cuando tenemos un formulario, cualquier elemento se encuentra disponible en la colección nombrada `form.elements`. -For instance: +Por ejemplo: ```html run height=40
@@ -26,19 +26,19 @@ For instance:
``` -There may be multiple elements with the same name, that's often the case with radio buttons. +Puede haber múltiples elementos con el mismo nombre, tal es el caso de los controles tipo radio. -In that case `form.elements[name]` is a collection, for instance: +En ese caso `form.elements[name]` es una colección, por ejemplo: ```html run height=40
@@ -57,13 +57,13 @@ alert(ageElems[0]); // [object HTMLInputElement] ``` -These navigation properties do not depend on the tag structure. All control elements, no matter how deep they are in the form, are available in `form.elements`. +Estas propiedades de navegación no dependen de la estructura de las etiquetas. Todos los controles, sin importar qué tan profundos se encuentren en el formulario, están disponibles en `form.elements`. -````smart header="Fieldsets as \"subforms\"" -A form may have one or many `
` elements inside it. They also have `elements` property that lists form controls inside them. +````smart header="Fieldsets como \"sub-formularios\"" +Un formulario puede tener uno o varios elementos `
` dentro. Estos también tienen la propiedad `elements` que enlista los controles del formulario dentro de ellos. -For instance: +Por ejemplo: ```html run height=80 @@ -81,7 +81,7 @@ For instance: let fieldset = form.elements.userFields; alert(fieldset); // HTMLFieldSetElement - // we can get the input by name both from the form and from the fieldset + // podemos obtener el input por su nombre tanto desde el formulario como desde el fieldset alert(fieldset.elements.login == form.elements.login); // true */!* @@ -89,14 +89,14 @@ For instance: ``` ```` -````warn header="Shorter notation: `form.name`" -There's a shorter notation: we can access the element as `form[index/name]`. +````warn header="Notación corta: `form.name`" +Hay una notación corta: podemos acceder el elemento como `form[index/name]`. -In other words, instead of `form.elements.login` we can write `form.login`. +En otras palabras, en lugar de `form.elements.login` podemos escribir `form.login`. -That also works, but there's a minor issue: if we access an element, and then change its `name`, then it is still available under the old name (as well as under the new one). +Esto también funciona, pero tiene un error menor: si accedemos un elemento, y cambiamos su `name`, se mantendrá disponible mediante el nombre anterior (así como mediante el nuevo). -That's easy to see in an example: +Esto es fácil de ver en un ejemplo: ```html run height=40 @@ -104,34 +104,34 @@ That's easy to see in an example: ``` -That's usually not a problem, because we rarely change names of form elements. +Esto usualmente no es un problema, porque raramente se cambian los nombres de los elementos de un formulario. ```` -## Backreference: element.form +## Referencia inversa: element.form -For any element, the form is available as `element.form`. So a form references all elements, and elements reference the form. +Para cualquier elemento, el formulario está disponible como `element.form`. Así que un formulario referencia todos los elementos, y los elementos referencian el formulario. -Here's the picture: +Aquí la imagen: ![](form-navigation.svg) -For instance: +Por ejemplo: ```html run height=40
@@ -149,46 +149,46 @@ For instance: ``` -## Form elements +## Elementos del formulario -Let's talk about form controls. +Hablemos de los controles de los formularios. -### input and textarea +### input y textarea -We can access their value as `input.value` (string) or `input.checked` (boolean) for checkboxes. +Podemos acceder sus valores como `input.value` (cadena) o `input.checked` (booleano) para casillas de verificación (checkboxes). -Like this: +De esta manera: ```js input.value = "New value"; textarea.value = "New text"; -input.checked = true; // for a checkbox or radio button +input.checked = true; // para checkboxes o radios ``` -```warn header="Use `textarea.value`, not `textarea.innerHTML`" -Please note that even though `` holds its value as nested HTML, we should never use `textarea.innerHTML` to access it. +```warn header="Usa `textarea.value`, no `textarea.innerHTML`" +Observa que incluso aunque `` contenga su valor como HTML anidado, nunca deberíamos usar `textarea.innerHTML` para acceder a él. -It stores only the HTML that was initially on the page, not the current value. +Esto solo guarda el HTML que había inicialmente en la página, no su valor actual. ``` -### select and option +### select y option -A `` tiene 3 propiedades importantes: -1. `select.options` -- the collection of `