# onMouseEnter / onMouseLeave event issue

**URL:** <https://forum.inductiveautomation.com/t/onmouseenter-onmouseleave-event-issue/84051>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [January 10, 2024, 5:01pm UTC](https://forum.inductiveautomation.com/t/onmouseenter-onmouseleave-event-issue/84051 "2024-01-10T17:01:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_Houston](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nicholas_houston/32/68700_2.png) [@Nicholas\_Houston](https://forum.inductiveautomation.com/u/Nicholas_Houston)\
**Post date:** [January 10, 2024, 5:01pm UTC](https://forum.inductiveautomation.com/t/onmouseenter-onmouseleave-event-issue/84051/1 "2024-01-10T17:01:11Z")

</div>

I am using an event in order to display a label when the mouse enters the container for a template view. If the mouse enters and exits the container to fast the label remains visible. Is there any way to fix this issue? Maybe make the label go away if the mouse isnt in the container for a certain amount of time? Below are the event scripts I have written. Also there is an example of the issue (bottom picture)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/f/7fc35c0b2c1e84e2d8c5bdb3d0d7c9b732f029fa.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/5/450314c6337799f3a0e83eab5826815c78bc0620.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/f/2f2e47efb856f4b0dfd8789e92d3c39b47e27d5f.png)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 10, 2024, 5:07pm UTC](https://forum.inductiveautomation.com/t/onmouseenter-onmouseleave-event-issue/84051/2 "2024-01-10T17:07:07Z")

</div>

You should accomplish this with CSS, via the custom stylesheet. Scripting events require an entire roundtrip to the gateway and back, making them unsuitable for purposes like this.

You can use a meta selector to react to the hover and add text to an element with CSS.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [January 10, 2024, 5:08pm UTC](https://forum.inductiveautomation.com/t/onmouseenter-onmouseleave-event-issue/84051/3 "2024-01-10T17:08:15Z")

</div>

I'm not sure where you're doing this, but consider the use of the component's tooltip as a built-in option.

---

<div class="post-metadata">

**Author:** ![Nicholas\_Houston](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nicholas_houston/32/68700_2.png) [@Nicholas\_Houston](https://forum.inductiveautomation.com/u/Nicholas_Houston)\
**Post date:** [January 10, 2024, 7:34pm UTC](https://forum.inductiveautomation.com/t/onmouseenter-onmouseleave-event-issue/84051/4 "2024-01-10T19:34:36Z")

</div>

I made a stylesheet with the perspective style class defined (image below). Applied it to the label. It did fix the issue of them getting stuck visible.

Is there any way to make this work when you hover over the root container of the view template, rather than only when you hover over the label?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/0/c06f5f82b63e2b9d8cb32462d3112bd06cbcd3b8.png)

---

<div class="post-metadata">

**Author:** ![Learner\_Ignition](https://avatars.discourse-cdn.com/v4/letter/l/b3f665/32.png) [@Learner\_Ignition](https://forum.inductiveautomation.com/u/Learner_Ignition)\
**Post date:** [January 11, 2024, 5:24am UTC](https://forum.inductiveautomation.com/t/onmouseenter-onmouseleave-event-issue/84051/5 "2024-01-11T05:24:47Z")

</div>

Hi,  
Did you try **onMouseOver** for displaying the label and **onMouseLeave** for hiding the label?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 11, 2024, 1:04pm UTC](https://forum.inductiveautomation.com/t/onmouseenter-onmouseleave-event-issue/84051/6 "2024-01-11T13:04:31Z")

</div>

The whole point of the replies here is that the mouse events cannot be made reliable.
