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

Usage and definition of mouseover in jQuery event

黄舟
Release: 2017-06-28 13:30:56
Original
2166 people have browsed it

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("欢迎您!")})
Copy after login

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>
Copy after login

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"); });
Copy after login

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!

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!