Home > Web Front-end > JS Tutorial > body text

What is the difference between mouseover and hover in jquery event?

黄舟
Release: 2017-06-28 13:36:26
Original
1001 people have browsed it

hover includes the process of moving the mouse onto the object , and at the same time moving the mouse out of the object, and the corresponding subclass is also selected.

And mouseover means that when the mouse passes over the object, its subclasses that do not include it are selected at the same time.

The main difference is that the eventdriver is also added to the subclass of the hover element. And mouseover only adds event driver to the current element.

And the hover event contains the mouseover event

mousemove(fn);
Copy after login

Bind a processing function to the mousemove event of each matching element.

hover(over, out);

A method that simulates hover events (the mouse moves over and out of an object). This is a custom method that provides a "keep in" state for frequently used tasks. When the mouse moves over a matching element, the specified first function will be triggered. When the mouse moves out of this element, the specified second function will be triggered. Moreover, it will be accompanied by detection of whether the mouse is still in a specific element (detection of subclasses). If so, it will continue to remain in the "hover" state without triggering the move-out event (mouseout).

$("td").hover(function () {  
    $(this).addClass("hover");  
    },function () {  
    $(this).removeClass("hover");  
});
Copy after login

The above is the detailed content of What is the difference between mouseover and hover in jquery event?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!