This article mainly introduces the usage of mouseoverevent in jQuery, and analyzes the usage skills of mouseoverevent handling when the mouse pointer slides over in the form of examples. It is necessary to Friends can refer to the following
This article describes the usage of the mouseover event in jQuery. Share it with everyone for your reference. The specific analysis is as follows:
The mouseover event is triggered when the mouse pointer is over the matching element or the mouseover() method is called.
A complete event process must not only have conditions that can trigger the event, but also an event handler.
You can bind an event handler to the mouseover event through the mouseover() method. For example:
$("p").mouseover(function(){$("p").text("欢迎您!")})
The above code is to bind the function function as an event handler to the mouseover event through the mouseover() method.
When the mouseover event is triggered, this function will be called.
Example code:
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"/> <meta name="author" content="http://www.jb51.net/" /> <title>mouseover事件</title> <script type="text/ javascript " src="mytest/jQuery/jquery-1.8.3.js"></script> <script type="text/javascript"> $( document ).ready(function(){ $("p").mouseover(function(){ $("p").text("欢迎您!"); }) }) </script> </head> <body> <p>原来的文字</p> </body> </html>
Overview
Bind a handler function to the mouseover event of each matching element.
The mouseover event will be triggered when the mouse moves into the object
Parameters
fnFunctionV1.0
The processing bound in the mouseover event of each matching element function.
[data],fnString,FunctionV1.4.3
data:mouseover([Data], fn) data can be passed in for function fn to process.
fn: The handler function bound in the mouseover event of each matching element.
Example
Description:
Change the background color of an element when the mouse pointer is over it:
jQuery Code:
$("p").mouseover(function(){ $("p").css("background-color","yellow"); });
The above is the detailed content of Usage and definition of mouseover in jQuery event. For more information, please follow other related articles on the PHP Chinese website!