It appears that this could have a negative impact on performance, as the code needs to be executed every time the user moves the mouse.
Even if the `mouseover` event is triggered frequently, it should not significantly affect performance unless there are intensive calculations within the handler. Typically, code like this is executed regularly by the browser for various reasons (such as libraries, plugins, extensions, or trackers). It is recommended not to be concerned about performance optimization until specific performance metrics are available.
It would be ideal if the code only ran when the `ctrl` key is pressed or released.
While the `mouseenter` and `mouseleave` events are available, they may not meet your requirements. Here is an example demonstrating their usage:
// Vue.js code
// CSS code
// HTML code
Clarification on the `mouseover` Event
According to MDN, the `mouseover` event is triggered when a pointing device moves onto the element with the listener attached or one of its child elements. It does not fire every time, but only when the mouse enters the element or its child.
For elements with multiple children, a workaround can be implemented to prevent the `mouseover` code from executing every time. This can involve creating an empty element or overlaying another element on top of the target element and attaching the event listener to the overlay.
Here is an example of how this workaround can be achieved:
// Vue.js code
// CSS code
// HTML code