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
Let's dive into more details about events that happen when mouse moves between elements.
3
+
Fare öğeler arasında hareket ettiğinde meydana gelen olaylar hakkında daha fazla ayrıntıya girelim.
4
4
5
5
## Mouseover/mouseout, relatedTarget
6
6
7
-
The `mouseover`event occurs when a mouse pointer comes over an element, and `mouseout`-- when it leaves.
7
+
`mouseover`olayı fare bir ögenin üzerine geldiğinde gerçekleşirken, `mouseout`fare bu ögenin üzerinden gittiği zaman gerçekleşir.
8
8
9
9

10
10
11
-
These events are special, because they have a `relatedTarget`.
11
+
Bu olaylar özeldir, çünkü `relatedTarget` özellikleri vardır.
12
12
13
-
This property complements `target`. When a mouse leaves one element for another, one of them becomes `target`, and the other one `relatedTarget`.
13
+
Bu özellik `target`ı (hedefi) tamamlar. Fare bir ögeyi diğer ögeye gitmek için bıraktığında, bunlardan biri `target` (hedef) , diğeri `relatedTarget`(ilişkiliTarget) olur.
14
14
15
-
For `mouseover`:
15
+
`mouseover` için:
16
16
17
-
-`event.target` -- is the element where the mouse came over.
18
-
-`event.relatedTarget` -- is the element from which the mouse came (`relatedTarget` -> `target`).
17
+
-`event.target` -- fareyle üzerine gelinen öge
18
+
-`event.relatedTarget` -- farenin hedefe gitmeden önce üzerinde oldugu öge `relatedTarget` (`relatedTarget` -> `target`).
19
19
20
-
For`mouseout`the reverse:
21
-
22
-
-`event.target` -- is the element that mouse left.
23
-
-`event.relatedTarget` -- is the new under-the-pointer element, that mouse left for (`target` -> `relatedTarget`).
20
+
`mouseout`için tam tersi:
21
+
22
+
-`event.target` -- farenin terk ettiği öge.
23
+
-`event.relatedTarget` -- farenin hedefteki ögeyi terk ettikten sonra gittiği öge. (`target` -> `relatedTarget`).
24
24
25
25
```online
26
-
In the example below each face feature is an element. When you move the mouse, you can see mouse events in the text area.
26
+
Aşağıdaki örnekte her yüz özelliği bir öğedir. Fareyi hareket ettirdiğinizde, metin alanında fare olaylarını görebilirsiniz.
27
27
28
-
Each event has the information about where the element came and where it came from.
28
+
Her olay, elementin nereden geldiği ve nereye gittiği hakkında bilgi içerir.
29
29
30
30
[codetabs src="mouseoverout" height=280]
31
31
```
32
32
33
-
```warn header="`relatedTarget`can be `null`"
34
-
The `relatedTarget`property can be `null`.
33
+
```warn header="`relatedTarget``null` olabilir"
34
+
`relatedTarget`özelliği `null` (boş) olabilir.
35
35
36
-
That's normal and just means that the mouse came not from another element, but from out of the window. Or that it left the window.
36
+
Bu normaldir ve sadece farenin başka bir elementten değil, pencerenin dışından geldiği anlamına gelir. Ya da pencereden çıktığı anlamına gelir.
37
37
38
-
We should keep that possibility in mind when using `event.relatedTarget`in our code. If we access `event.relatedTarget.tagName`, then there will be an error.
38
+
Kodumuzda `event.relatedTarget`kullanırken bu olasılığı hesaba katmalıyız.`event.relatedTarget.tagName` özelliğine ulaşırsak, bu hata verebilir.
39
39
```
40
40
41
-
## Events frequency
41
+
## Ögeleri atlama
42
42
43
-
The `mousemove` event triggers when the mouse moves. But that doesn't mean that every pixel leads to an event.
43
+
`mousemove` olayı fare hareket ettiğinde tetiklenir. Ancak bu her piksel bir olayı tetikler anlamına gelmez.
44
44
45
-
The browser checks the mouse position from time to time. And if it notices changes then triggers the events.
45
+
Tarayıcı farenin konumunu zaman içerisinde kontrol eder. Ve eğer konum değişikliği farekederse, olayı tetikler.
46
46
47
-
That means that if the visitor is moving the mouse very fast then DOM-elements may be skipped:
47
+
Bu, eğer kullanıcı fareyi çok hızlı hareket ettiriyorsa, bazı DOM ögelerinin atlanabileceği anlamına gelir.
48
48
49
49

50
50
51
-
If the mouse moves very fast from `#FROM` to `#TO` elements as painted above, then intermediate `<div>` (or some of them) may be skipped. The `mouseout` event may trigger on `#FROM` and then immediately `mouseover` on `#TO`.
51
+
Eğer fare `#FROM` ögesinden`#TO` ögesine çok hızlı bir şekilde hareket ederse, ortadaki `<div>` ögeleri (ya da bazıları) atlanabilir. `mouseout` olayı `#FROM` ogesinde ve ardından aniden `#TO` ögesi üzerinde tetiklenir.
52
52
53
-
In practice that's helpful, because if there may be many intermediate elements. We don't really want to process in and out of each one.
53
+
Bu, performans için iyidir, çünkü arada bir çok öge bulunabilir. Her birinde olay tetiklemeyi her zaman istemeyiz.
54
54
55
-
On the other hand, we should keep in mind that we can't assume that the mouse slowly moves from one event to another. No, it can "jump".
55
+
Öte yandan, fare ımlecinin yol boyunca tüm öğeleri "ziyaret etmediğini" unutmamalıyız. Bu ögelerin üzerinden "zıplayabilir".
56
56
57
-
In particular it's possible that the cursor jumps right inside the middle of the page from out of the window. And `relatedTarget=null`, because it came from "nowhere":
57
+
Özellikle, imlecin pencereden sayfanın ortasına doğru atlaması mümkündür. Bu durumda `relatedTarget=null`, olur çünkü imleç "hiçbir yerden" gelmiştir:
58
58
59
59

60
60
61
61
<div style="display:none">
62
-
In case of a fast move, intermediate elements may trigger no events. But if the mouse enters the element (`mouseover`), when we're guaranteed to have `mouseout` when it leaves it.
62
+
Hızlı fare hareketi durumunda, ortadaki elementler olay tetiklemeyebilirler. Ancak eger fare bır element üzerinde (`mouseover`) olayını tetiklediyse, fare ogeden uzaklastıgında `mouseout` olayının tetikleneceğini garantilemiş oluruz.
63
63
</div>
64
64
65
65
```online
66
-
Check it out "live" on a teststand below.
66
+
Aşağıdaki test standında "canlı" olarak kontrol edebilirsiniz.
67
67
68
-
The HTML is two nested `<div>` elements. If you move the mouse fast over them, then there may be no events at all, or maybe only the red div triggers events, or maybe the green one.
68
+
HTML iç içe geçmiş `<div>` ögelerinden oluşuyor. Eğer farenizi onların üzerinden hızlıca hareket ettirirseniz, hiç bir olay tetiklenmeyebilir, belki sadece kırmızı div olay tetikleyebilir ya da sadece yeşil div tetikleyebilir.
69
69
70
-
Also try to move the pointer over the red `div`, and then move it out quickly down through the green one. If the movement is fast enough then the parent element is ignored.
70
+
Ayrıca, fareyi kırmızı "div" nin üzerine getirmeyi deneyin ve ardından hızlıca yeşil olandan aşağı doğru hareket ettirin. Hareket yeterince hızlıysa, ana öğe göz ardı edilir.
71
71
72
72
[codetabs height=360 src="mouseoverout-fast"]
73
73
```
74
74
75
-
## "Extra" mouseout when leaving for a child
75
+
## Çocuk öge için ayrılırken "Ekstra" mouseout olayı
76
76
77
-
Imagine -- a mouse pointer entered an element. The `mouseover`triggered. Then the cursor goes into a child element. The interesting fact is that `mouseout`triggers in that case. The cursor is still in the element, but we have a `mouseout`from it!
77
+
Fareyle bir elementin üzerine geldiğinizi düşünün. `mouseover`olayı tetiklendi. Daha sonra fare imleci iç içe geçmiş çocuk elementin üzerine gittiğini varsayalım. İlginç olarak `mouseout`olayı tetiklenir. Fare imleci teknik olarak hala elementin üzerinde, ancak biz buradan ekstra bir `mouseout`olayı çıkarmış olduk.
78
78
79
79

80
80
81
-
That seems strange, but can be easily explained.
81
+
Bu ilginç görünebilir ancak kolayca açıklanabilir bir durumdur.
82
82
83
-
**According to the browser logic, the mouse cursor may be only over a *single* element at any time -- the most nested one (and top by z-index).**
83
+
**Tarayıcı mantığına göre, fare imleci herhangi bir zamanda yalnızca *tek* bir öğenin üzerinde olabilir - en içte olanı seçer ( z-endeksi en yüksek olanı yani en üstte olanı).**
84
84
85
-
So if it goes to another element (even a descendant), then it leaves the previous one. That simple.
85
+
Yani başka bir öğeye giderse (aynı ögeye baglı bıle olsa), o zaman bir öncekinden ayrılmış kabul edilir. Bu kadar basit.
86
86
87
-
There's a funny consequence that we can see on the example below.
87
+
Buradan aşağıdaki örnekte görebileceğimiz komik bir sonuç çıkar.
88
88
89
-
The red `<div>`is nested inside the blue one. The blue `<div>`has `mouseover/out`handlers that log all events in the textarea below.
89
+
Kırmızı `<div>`mavi olanın içine konmuştur. Mavi `<div>``mouseover/out`olayı tetiklendiği zamanlarda aşağıdaki metin alanına yazan bir şekilde kodlanmıştır.
90
90
91
-
Try entering the blue element and then moving the mouse on the red one -- and watch the events:
91
+
Mavi öğeye girip fareyi kırmızı öğenin üzerine getirmeyi deneyin ve olayları izleyin:
92
92
93
93
[codetabs height=360 src="mouseoverout-child"]
94
94
95
-
1.On entering the blue one -- we get `mouseover [target: blue]`.
96
-
2.Then after moving from the blue to the red one -- we get `mouseout [target: blue]`(left the parent).
97
-
3. ...And immediately`mouseover [target: red]`.
95
+
1.Mavi ogeye girerken -- `mouseover [target: blue]` olayı tetiklenir.
96
+
2.TMavi olandan kırmızı olana hareket ettikten sonra -- `mouseout [target: blue]`olayı tetiklenir.
97
+
3. ...Ve aniden`mouseover [target: red]`.
98
98
99
-
So, for a handler that does not take `target` into account, it looks like we left the parent in `mouseout` in `(2)` and returned back to it by `mouseover` in `(3)`.
99
+
Bu nedenle, "hedef" i hesaba katmayan bir kod için, "(2)" öğesinde "mouseout" öğesinde üstteki ögeyi bıraktık ve "(3)" öğesinde "mouseover" ile ona geri döndük gibi görünüyor.
100
100
101
-
If we perform some actions on entering/leaving the element, then we'll get a lot of extra "false" runs. For simple stuff that may be unnoticeable. For complex things that may bring unwanted side-effects.
101
+
Sonuç olarak öğeye girme / öğeden çıkma konusunda bazı eylemler gerçekleştirir, sadece bunları hesaba katarak bir yazılım geliştirirsek birçok ekstra "yanlış" sonuç elde edebiliriz.
102
102
103
-
We can fix it by using `mouseenter/mouseleave`events instead.
103
+
Bu sorunu `mouseenter/mouseleave`olaylarını kullanarak düzeltebiliriz.
104
104
105
-
## Events mouseenter and mouseleave
105
+
## mouseenter and mouseleave olayları
106
106
107
-
Events `mouseenter/mouseleave`are like `mouseover/mouseout`. They also trigger when the mouse pointer enters/leaves the element.
107
+
`mouseenter/mouseleave`olayları `mouseover/mouseout` olaylarına benzer şekilde çalışır. Bunlar da imleç bir ögenin üzerine geldiğinde/ ayrıldığında tetiklenir.
When the pointer enters an element -- the `mouseenter`triggers, and then doesn't matter where it goes while inside the element. The `mouseleave`event only triggers when the cursor leaves it.
116
+
İmleç bir elementin üzerine geldiği zaman -- `mouseenter`tetiklenir, ve bu elementin içinde nereye hareket ettiği önem taşımaz. `mouseleave`olayı ancak imleç o elementten tamamen ayrıldığı zaman tetiklenir.
117
117
118
-
If we make the same example, but put `mouseenter/mouseleave`on the blue `<div>`, and do the same -- we can see that events trigger only on entering and leaving the blue `<div>`. No extra events when going to the red one and back. Children are ignored.
118
+
Eğer aynı örneği verecek olursak, `mouseenter/mouseleave`olayını mavi `<div>` üzerinde denersek, aynı hareketi yaptığımız zaman-- olayların sadece `<div>` ögesinden girişte ve çıkışta tetiklendiğini görürüz. Ekstra olarak kırmızı olana giriş çıkışta olay tetiklenmez. İç içe geçmiş çocuk elementler göz ardı edilir.
119
119
120
120
[codetabs height=340 src="mouseleave"]
121
121
122
-
## Event delegation
122
+
## Olay delegasyonu (Event delegation)
123
123
124
-
Events `mouseenter/leave`are very simple and easy to use. But they do not bubble. So we can't use event delegation with them.
124
+
`mouseenter/leave`olaylarının kullanımı çok basittir. Ancak kabarcıklanma (bubble) yapmazlar. Bu yüzden bu olaylarla olay delegasyonu yapamayız.
125
125
126
-
Imagine we want to handle mouse enter/leave for table cells. And there are hundreds of cells.
126
+
Tablo hücreleri için fare giriş / çıkışını işlemek istediğimizi hayal edin. Ve yüzlerce hücre var.
127
127
128
-
The natural solution would be -- to set the handler on `<table>` and process events there. But `mouseenter/leave` don't bubble. So if such event happens on `<td>`, then only a handler on that `<td>` can catch it.
128
+
Doğal çözüm - işleyiciyi "<table>" a ayarlamak ve oradaki olayları işlemek olacaktır. Ancak "fare gir / bırak" kabarma yapmayacak. Yani eğer böyle bir olay "<td>" üzerinde meydana gelirse, o zaman sadece "<td>" üzerindeki bir işleyici onu yakalayabilir.
129
129
130
-
Handlers for`mouseenter/leave`on `<table>` only trigger on entering/leaving the whole table. It's impossible to get any information about transitions inside it.
130
+
`<table>` üzerindeki,`mouseenter/leave`işleyicileri sadece bütün tabloya girerken/ayrılırken tetiklenir. Tablo içinde olan hareketleri takip etmek imkansızdır.
131
131
132
-
Not a problem -- let's use `mouseover/mouseout`.
132
+
Bu problem değil -- `mouseover/mouseout` kullanabiliriz.
These handlers work when going from any element to any inside the table.
153
+
Bu işleyiciler, herhangi bir öğeden tablonun içindeki herhangi bir diğer ogeye giderken çalışır.
154
154
155
-
But we'd like to handle only transitions in and out of `<td>` as a whole. And highlight the cells as a whole. We don't want to handle transitions that happen between the children of `<td>`.
155
+
Ancak biz `<td>` ogelerinin, yalnızca içeri ve dışarı geçişlerini ele almak istiyoruz. Ve hücreleri bir bütün olarak ışıklandırmak istiyoruz. Hücrenin içi veya herhangi bir hücrenin dışı gibi diğer geçişler bizi ilgilendirmez. Onları filtreleyebiliriz.
156
156
157
-
One of solutions:
157
+
Çözümlerden biri:
158
158
159
-
-Remember the currently highlighted `<td>`in a variable.
160
-
-On `mouseover` -- ignore the event if we're still inside the current `<td>`.
161
-
-On `mouseout` -- ignore if we didn't leave the current `<td>`.
159
+
-Bir değişkende şu anda ışıklandırılmış `<td>`elementini hatırlayalim. Buna `currentElem` diyelim .
160
+
-`mouseover`olayı -- eğer hala `currentElem` içindeysek olayı gözardı et.
161
+
-`mouseout`olayı -- eğer hala `currentElem` ter etmediysek olayı gözardı et.
162
162
163
-
That filters out "extra" events when we are moving between the children of `<td>`.
163
+
Bu, "<td>" nin çocukları arasında hareket ettiğimizde "ekstra" olayları filtreler.
164
164
165
165
```offline
166
166
The details are in the [full example](sandbox:mouseenter-mouseleave-delegation-2).
Try to move the cursor in and out of table cells and inside them. Fast or slow -- doesn't matter. Only `<td>` as a whole is highlighted unlike the example before.
174
+
İmleci tablo hücrelerinin içine, dışına ve içlerine taşımaya çalışın. Hızlı veya yavaş olamsı önemli değil. Önceki örnekten farkı burada yalnızca "<td>" nin bir bütün olarak ışıklandırılmış olmasıdır.
175
+
175
176
```
176
177
177
178
178
179
## Summary
179
180
180
-
We covered events `mouseover`, `mouseout`, `mousemove`, `mouseenter` and `mouseleave`.
181
+
`mouseover`, `mouseout`, `mousemove`, `mouseenter` ve `mouseleave` olaylarını inceledik.
182
+
183
+
Not edilmesi gerekenler:
184
+
185
+
- Hızlı imleç hareketi `mouseover, mousemove, mouseout` olaylarının ortadaki elementleri atlamasına sebep olabilir.
186
+
-`mouseover/out` ve `mouseenter/leave` olaylarının ekstra bir hedef özelliği vardir: `relatedTarget`. Bu `target` özelliğini tamamlayıcı olarak işlev görür.
181
187
182
-
Things that are good to note:
188
+
-`mouseover/out` olayları anne elementten çocuk elemente hareket ettiğimizde dahi tetiklenir. Tarayıcı bir imlecin aynı anda sadece bir elementin üstünde olabileceğini varsayar -- en içteki olanın üzerinde.
183
189
184
-
- A fast mouse move can make `mouseover, mousemove, mouseout` to skip intermediate elements.
185
-
- Events `mouseover/out` and `mouseenter/leave` have an additional target: `relatedTarget`. That's the element that we are coming from/to, complementary to `target`.
186
-
- Events `mouseover/out` trigger even when we go from the parent element to a child element. They assume that the mouse can be only over one element at one time -- the deepest one.
187
-
- Events `mouseenter/leave` do not bubble and do not trigger when the mouse goes to a child element. They only track whether the mouse comes inside and outside the element as a whole.
190
+
-`mouseenter/leave` olayalrı kabarcık (bubble) yapmaz ve imleç içteki çocuk elementin üzerine gittiğinde tetiklenmez. Sadece imlecin elementin tamamı üzerine girip / ayrılması ile tetiklenirler, diğer öge içinde hareketleri göz ardı ederler.
0 commit comments