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/2-events/03-event-delegation/4-behavior-tooltip/task.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,37 +2,37 @@ importance: 5
2
2
3
3
---
4
4
5
-
# Tooltip behavior
5
+
# 툴팁 보여주기
6
6
7
-
Create JS-code for the tooltip behavior.
7
+
툴팁(tooltip)을 보여주는 JS 코드를 작성해봅시다.
8
8
9
-
When a mouse comes over an element with `data-tooltip`, the tooltip should appear over it, and when it's gone then hide.
9
+
`data-tooltip` 속성이 있는 요소에 마우스를 가져다 대면 툴팁이 보여야 하고, 마우스 커서가 요소에서 떠나면 툴팁이 사라져야 합니다.
10
10
11
-
An example of annotated HTML:
11
+
`data-tooltip` 속성은 다음 HTML처럼 추가할 수 있습니다.
12
12
```html
13
-
<buttondata-tooltip="the tooltip is longer than the element">Short button</button>
14
-
<buttondata-tooltip="HTML<br>tooltip">One more button</button>
13
+
<buttondata-tooltip="버튼 요소 길이보다 툴팁 길이가 훨씬 기네요.">짧은 버튼</button>
14
+
<buttondata-tooltip="두 줄짜리<br>툴팁">...또 다른 버튼...</button>
15
15
```
16
16
17
-
Should work like this:
17
+
답을 잘 작성했다면 아래 예시처럼 동작해야 합니다.
18
18
19
19
[iframe src="solution" height=200 border=1]
20
20
21
-
In this task we assume that all elements with `data-tooltip` have only text inside. No nested tags (yet).
21
+
`data-tooltip`이 있는 요소엔 텍스트만 있다고 가정하겠습니다. 요소 안에 다른 태그가 있는 경우는 생각하지 않기로 합시다.
22
22
23
-
Details:
23
+
자세한 요구사항은 다음과 같습니다.
24
24
25
-
-The distance between the element and the tooltip should be `5px`.
26
-
-The tooltip should be centered relative to the element, if possible.
27
-
-The tooltip should not cross window edges. Normally it should be above the element, but if the element is at the page top and there's no space for the tooltip, then below it.
28
-
-The tooltip content is given in the `data-tooltip`attribute. It can be arbitrary HTML.
25
+
-툴팁과 요소의 간격은 `5px`입니다.
26
+
-가능하면 툴팁은 요소를 기준으로 중앙에 있도록 합시다.
27
+
-툴팁은 창 크기보다 커질 수 없습니다. 일반적인 경우라면 툴팁은 요소 위에 있을 텐데, 요소가 창 맨 위에 있어서 툴팁을 보여줄 공간이 없다면 툴팁은 요소 아래에 나타납니다.
28
+
-툴팁안에 띄울 콘텐츠는 `data-tooltip`속성에서 가져옵니다. 속성값은 HTML일 수 있습니다.
29
29
30
-
You'll need two events here:
31
-
-`mouseover`triggers when a pointer comes over an element.
32
-
-`mouseout` triggers when a pointer leaves an element.
30
+
원하는 기능을 구현하려면 다음 두 가지 이벤트가 필요합니다.
31
+
-`mouseover`-- 요소 안으로 포인터가 이동할 때 발생하는 이벤트
32
+
-`mouseout`-- 요소 밖으로 포인터가 이동할 때 발생하는 이벤트
33
33
34
-
Please use event delegation: set up two handlers on`document` to track all "overs" and "outs" from elements with `data-tooltip` and manage tooltips from there.
34
+
이벤트 위임을 사용해서 두 개의 핸들러만으로 원하는 기능을 구현하세요.`document`에 핸들러를 추가해 `data-tooltip` 속성이 있는 요소 안이나 밖으로 마우스 포인터가 이동하는 경우를 모두 감지하고 두 핸들러를 통해 툴팁을 보여주거나 감추시면 됩니다.
35
35
36
-
After the behavior is implemented, even people unfamiliar with JavaScript can add annotated elements.
36
+
이렇게 툴팁 기능을 구현해 놓으면 자바스크립트에 익숙하지 않은 사람도 원하는 요소에 쉽게 툴팁을 보여줄 수 있을 겁니다.
0 commit comments