Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable mouseover event from everywhere using javascript/jquery?

I am using raphael.js library and this file contains a mouseover event which I want to stop working. Can anyone help me?

like image 246
Ashish Avatar asked Oct 29 '15 05:10

Ashish


People also ask

What is the use of mouseover event in HTML?

This method is a shortcut for .on ( "mouseover", handler ) in the first two variations, and .trigger ( "mouseover" ) in the third. The mouseover event is sent to an element when the mouse pointer enters the element. Any HTML element can receive this event.

How to turn off hover events in jQuery?

(Make sure Hover effect should be added by JQuery only, Hover effect added by CSS doesn’t work here). Use either .unbind () or .off () method. Pass the events that we want to turn off for that particular element. Example 1: This example using the .unbind () method. How to unbind “hover” event using JQuery?

What is the difference between mouseEnter and mouseover?

The mouseover () method triggers the mouseover event, or attaches a function to run when a mouseover event occurs. Note: Unlike the mouseenter event, the mouseover event triggers if a mouse pointer enters any child elements as well as the selected element.

What is the use of an event in a jQuery script?

jQuery not only allows us to attach event handlers on the element and it also allows us to take control of the flow of the events. You can enable and disable an event whenever you want in your script.


1 Answers

You could use CSS:

.element {
    pointer-events: none;
}

Or something like:

$('.element').on('mouseover mouseenter mouseleave mouseup mousedown', function() {
   return false
});

I don't know from what you want to prevent that event from triggering something, please be more specific on your questions and provide more relevant information.

like image 110
Aramil Rey Avatar answered Nov 14 '22 22:11

Aramil Rey