diff --git a/2-ui/3-event-details/4-drag-and-drop/2-drag-heroes/solution.md b/2-ui/3-event-details/4-drag-and-drop/2-drag-heroes/solution.md index 7178a96f..deb43b65 100644 --- a/2-ui/3-event-details/4-drag-and-drop/2-drag-heroes/solution.md +++ b/2-ui/3-event-details/4-drag-and-drop/2-drag-heroes/solution.md @@ -1,5 +1,5 @@ -В решении этой задачи для переноса мы используем координаты относительно окна и `position:fixed`. Так проще. +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`. -А по окончании -- прибавляем прокрутку и делаем `position:absolute`, чтобы элемент был привязан к определённому месту в документе, а не в окне. Можно было и сразу `position:absolute` и оперировать в абсолютных координатах, но код был бы немного длиннее. +Then, when coordinates are at window top/bottom, we use `window.scrollTo` to scroll it. -Детали решения расписаны в комментариях в исходном коде. \ No newline at end of file +More details in the code, in comments. diff --git a/2-ui/3-event-details/4-drag-and-drop/2-drag-heroes/solution.view/field.svg b/2-ui/3-event-details/4-drag-and-drop/2-drag-heroes/solution.view/field.svg new file mode 100644 index 00000000..81ecde02 --- /dev/null +++ b/2-ui/3-event-details/4-drag-and-drop/2-drag-heroes/solution.view/field.svg @@ -0,0 +1,32 @@ + + + \ No newline at end of file diff --git a/2-ui/3-event-details/4-drag-and-drop/2-drag-heroes/solution.view/index.html b/2-ui/3-event-details/4-drag-and-drop/2-drag-heroes/solution.view/index.html index a0a9b9bd..d79ef30a 100644 --- a/2-ui/3-event-details/4-drag-and-drop/2-drag-heroes/solution.view/index.html +++ b/2-ui/3-event-details/4-drag-and-drop/2-drag-heroes/solution.view/index.html @@ -8,13 +8,17 @@
-Супергерои и мяч -- это элементы с классом "draggable". Сделайте так, чтобы их можно было переносить.
+Superheroes and the ball are elements with the class "draggable". Make them really draggable.
-Важно: если супергероя подносят к низу или верху страницы, она должна автоматически прокручиваться. Если страница помещается на вашем экране целиком и не имеет вертикальной прокрутки -- сделайте окно браузера меньше, чтобы протестировать эту возможность.
+Important: limit dragging by the window. If a draggable reaches window top or bottom, then the page should scroll to let us drag it further.
-Да, и ещё: супергерои ни при каких условиях не должны попасть за край экрана.
+If your screen is big enough to fit the whole document -- make the window smaller to get vertical scrolling, so that you could test it.
+ +In this task it's enough to handle vertical scrolling. There's no horizontal scrolling usually, and it's handled the similar way if needed.
+ +And one more thing: heroes may never leave the page. If they reach the edge of the document, no dragging outside of it.
Супергерои и мяч -- это элементы с классом "draggable". Сделайте так, чтобы их можно было переносить.
+Superheroes and the ball are elements with the class "draggable". Make them really draggable.
-Важно: если супергероя подносят к низу или верху страницы, она должна автоматически прокручиваться. Если страница помещается на вашем экране целиком и не имеет вертикальной прокрутки -- сделайте окно браузера меньше, чтобы протестировать эту возможность.
+Important: limit dragging by the window. If a draggable reaches window top or bottom, then the page should scroll to let us drag it further.
-Да, и ещё: супергерои ни при каких условиях не должны попасть за край экрана.
+If your screen is big enough to fit the whole document -- make the window smaller to get vertical scrolling, so that you could test it.
+ +In this task it's enough to handle vertical scrolling. There's no horizontal scrolling usually, and it's handled the similar way if needed.
+ +And one more thing: heroes may never leave the page. If they reach the edge of the document, no dragging outside of it.