Home  >  Article  >  Web Front-end  >  How to trigger JS when the mouse moves over a div block? _html/css_WEB-ITnose

How to trigger JS when the mouse moves over a div block? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:13:571516browse

Homepage




In this sentence, there will be action only when the mouse is moved to the two words "Home Page", which is the link.

How to move it to a div to have an effect?


Reply to discussion (solution)

The area size of a link is the size of the text display area inside it. Just write onmouseover as a div event.

a is placed in a div.

onmouseover is written as a div

You didn’t make it clear which DIV and what is the order of the code.

Use jQuery to set an id to the target div, and then execute the statement $("#id").hover(function(){},funtion(){})

Statement:
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