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
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/en-US/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,17 @@ 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
23
-
24
-
In our case we need to substract the border size from the outer coordinates.
25
-
26
-
We could use CSS way:
22
+
# الزاوية الداخلية اليمنى السفلية
23
+
في حالتنا ، نحتاج إلى طرح حجم الحدود من الإحداثيات الخارجية.
24
+
يمكننا استخدام طريقة CSS:
27
25
28
26
```js
29
27
let answer4 = [
@@ -32,11 +30,12 @@ let answer4 = [
32
30
];
33
31
```
34
32
35
-
An alternative way would be to add `clientWidth/clientHeight` to coordinates of the left-upper corner. That's probably even better:
33
+
هناك طريقة بديلة تتمثل في إضافة "clientWidth / clientHeight" إلى إحداثيات الزاوية العلوية اليسرى. ربما هذا أفضل:
Create a function `positionAt(anchor, position, elem)`that positions`elem`, depending on `position`near `anchor` element.
6
+
إنشاء وظيفة `positionAt (مرساة ، موضع ، elem)`تضع مواضع`elem` ، اعتمادًا على`position`بالقرب من عنصر `anchor`.
8
7
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`
8
+
يجب أن يكون "الموضع" عبارة عن سلسلة تحتوي على أي قيمة من 3 قيم:
9
+
- `` top '' - ضع`elem`فوق`anchor` مباشرة
10
+
-"" right "" - ضع "elem" مباشرة على يمين "anchor"
11
+
-"أسفل" "- ضع" elem "أسفل" anchor "مباشرة
13
12
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`.
13
+
يتم استخدامه داخل الوظيفة`showNote(anchor ، position ، html)` ، المتوفرة في شفرة مصدر المهمة ، والتي تنشئ عنصر "note" مع `html`معينًا وتعرضه في" الموضع "القريب من" anchor ".
Extend the previous task <info:task/position-at-absolute>: teach the function `positionAt(anchor, position, elem)` to insert `elem` inside the `anchor`.
0 commit comments