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
+
# Perilaku Tooltip
6
6
7
-
Create JS-code for the tooltip behavior.
7
+
Buat Kode JS untuk perilaku tooltip.
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
+
Pada saat mouse menghampir sebuah elemen dengan `data-tooltip`, tooltip harus tampil diatasnya, dan pada saat mouse itu pindah tooltipnya di sembunyikan.
10
10
11
-
An example of annotated HTML:
11
+
Contoh dari HTML yang beranotasi:
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="Tooltip lebih panjang dari elemen tombol">Tombol pendek</button>
In this task we assume that all elements with`data-tooltip`have only text inside. No nested tags (yet).
21
+
Pada tugas ini kita beranggapan bawah semua elemen dengan`data-tooltip`memiliki teks didalamnya, Tidak ada elemen bersarang (belum).
22
22
23
-
Details:
23
+
Rincian:
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
+
-Jarak antara elemen dan tooltip harusnya`5px`.
26
+
-Jika memungkinkan, tooltip harus ditengah relatif pada elemen yang beranotasi.
27
+
-Tooltip tidak boleh melewati ujung dari jendela (_window_). Biasanya tooltip harus berada di atas elemen, tapi jika elemen itu berada pada bagian atas halaman, dan tidak ada area untuk tooltip, maka posisi tooltip dibawah elemen.
28
+
-Konten tooltip diberikan dalam atribut 'data-tooltip'. Ini bisa menjadi HTML asalan.
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
+
Kamu akan membutuhkan 2 peristiwa:
31
+
-`mouseover`akan dijalankan pada saat pointer berada di atas elemen beranotasi.
32
+
-`mouseout`akan dijalankan pada saat pointer meninggalkan elemen yang beranotasi.
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
+
Tolong gunakan delegasi peristiwa: atur 2 buah penangan pada`document`untuk melacak semua "masukan" dan "keluaran" dari elemen yang memiliki `data-tooltip`dan untuk menanggani tooltip dari elemen itu.
35
35
36
-
After the behavior is implemented, even people unfamiliar with JavaScript can add annotated elements.
36
+
Setelah perilaku tooltip dibuat, bahkan orang yang tidak familiar dengan JavaScript bisa menambahkan elemen yang beranotasi.
0 commit comments