Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to change the background color after mouse pass by jquery

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, the editor will share with you the relevant knowledge points about how to change the background color of the mouse by jquery. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Implementation method: 1, use the hover () method to bind the element mouse over event, and specify the event handler function; 2, in the event handler function, use the css () method to modify the background style to change the background color, syntax "element node .css (" background "," color value ");".

The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.

Jquery realizes that the mouse changes the background color.

Implementation method:

Use the hover () method to bind the mouse over event to the element and specify the event handler

In the event handler, use the css () method to modify the background style to change the background color

Implementation code:

$(document) .ready (function () {$("p") .hover (function () {$("p"). Css ("background", "yellow");}) Mouse over the paragraph.

Description: hover ()

Triggers mouseenter and mouseleave events.

The hover () method specifies two functions to run when the mouse pointer hovers over the selected element.

Two event functions are bound to the matching element and are executed when the mouse pointer enters and leaves the element, respectively. Bind a separate event function to the matching element, which is executed when the mouse pointer enters and leaves the element, respectively.

These are all the contents of the article "how to change the background color with the mouse in jquery". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report