You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2-ui/1-document/11-coordinates/1-find-point-coordinates/solution.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
# Outer corners
1
+
# Внешние углы
2
2
3
-
Outer corners are basically what we get from [elem.getBoundingClientRect()](https://developer.mozilla.org/en-US/docs/DOM/element.getBoundingClientRect).
3
+
Координаты внешних углов -- это как раз то, что возвращает функция [elem.getBoundingClientRect()](https://developer.mozilla.org/ru/docs/DOM/element.getBoundingClientRect).
4
4
5
-
Coordinates of the upper-left corner `answer1`and the bottom-right corner`answer2`:
5
+
Координаты верхнего левого внешнего угла будут в переменной `answer1`и нижнего правого -- в`answer2`:
6
6
7
7
```js
8
8
let coords =elem.getBoundingClientRect();
@@ -11,19 +11,19 @@ let answer1 = [coords.left, coords.top];
11
11
let answer2 = [coords.right, coords.bottom];
12
12
```
13
13
14
-
# Left-upper inner corner
14
+
# Верхний левый внутренний угол
15
15
16
-
That differs from the outer corner by the border width. A reliable way to get the distance is`clientLeft/clientTop`:
16
+
Тут значения отличаются на ширину рамки. Надёжный способ получить интересующее значение -- это использовать`clientLeft/clientTop`:
17
17
18
18
```js
19
19
let answer3 = [coords.left+field.clientLeft, coords.top+field.clientTop];
20
20
```
21
21
22
-
# Right-bottom inner corner
22
+
# Нижний правый внутренний угол
23
23
24
-
In our case we need to substract the border size from the outer coordinates.
24
+
В нашем случае нужно вычесть размеры рамки из внешних координат.
25
25
26
-
We could use CSS way:
26
+
Это может быть сделано с помощью CSS:
27
27
28
28
```js
29
29
let answer4 = [
@@ -32,7 +32,7 @@ let answer4 = [
32
32
];
33
33
```
34
34
35
-
An alternative way would be to add `clientWidth/clientHeight`to coordinates of the left-upper corner. That's probably even better:
35
+
Другим вариантом решения было бы добавление `clientWidth/clientHeight`к координатам верхнего левого угла. Так даже было бы лучше.
Copy file name to clipboardExpand all lines: 2-ui/1-document/11-coordinates/2-position-at/task.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,18 @@ importance: 5
2
2
3
3
---
4
4
5
-
# Show a note near the element
5
+
# Покажите заметку рядом с элементом
6
6
7
-
Create a function `positionAt(anchor, position, elem)` that positions `elem`, depending on `position`near `anchor` element.
7
+
Создайте функцию `positionAt(anchor, position, elem)`, которая позиционирует элемент `elem` в зависимости от значения свойства `position`рядом с элементом `anchor`.
8
8
9
-
The`position`must be a string with any one of 3 values:
10
-
-`"top"` - position`elem`right above`anchor`
11
-
-`"right"` - position`elem`immediately at the right of`anchor`
12
-
-`"bottom"` - position`elem`right below`anchor`
9
+
Аргумент`position`- строка с одним из 3 значений:
10
+
-`"top"` - расположить`elem`прямо над`anchor`
11
+
-`"right"` - расположить`elem`непосредственно справа от`anchor`
12
+
-`"bottom"` - расположить`elem`прямо под`anchor`
13
13
14
-
It's used inside function `showNote(anchor, position, html)`, provided in the task source code, that creates a "note" element with given `html` and shows it at the given `position` near the `anchor`.
14
+
Она используется внутри функции `showNote(anchor, position, html)`, которая уже есть в исходном коде задачи. Она создаёт и показывает элемент-"заметку" с текстом `html` на заданной позиции `position` рядом с элементом `anchor`.
0 commit comments