jquery mouseover() method


  Translation results:

mouse

English [maʊs] American [maʊs]

n. Mouse; mouse; shy [timid] person; [informal term] eye bruises on the head

vi.Catch mice; spy, secretly search

over

English[ˈəʊvə(r)] US[ˈoʊvə(r )]

prep. (indicating the direction) over; (partially or completely covering) on...; due to; (indicating talking about) about

adv. ending; again; (inverted) down; from one side to the other side

adj.past;outside;on;superior

n.extra;remaining;remaining (or excess) amount;residue

int.[Telecommunications] The message is finished, please reply!

vt.walk over, skip over; [American dialect] recover from...

jquery mouseover() methodsyntax

Function:When the mouse pointer is over an element, the mouseover event occurs. This event is most often used together with the mouseout event. The mouseover() method triggers a mouseover event, or specifies a function to run when a mouseover event occurs. Unlike the mouseenter event, the mouseover event will be triggered whenever the mouse pointer passes through the selected element or its sub-elements. The mouseenter event is only fired when the mouse pointer passes over the selected element. See the example below for a demonstration.

Trigger the mouseover event syntax: $(selector).mouseover()

Bind the function to the mouseover event syntax: $ (selector).mouseover(function)

Parameters:

ParametersDescription
function Optional. Specifies a function to run when a mouseover event occurs.

jquery mouseover() methodexample

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("p").mouseover(function(){
    $("p").css("background-color","yellow");
  });
  $("p").mouseout(function(){
    $("p").css("background-color","#E9E9E4");
  });
});
</script>
</head>
<body>
<p style="background-color:#E9E9E4">请把鼠标指针移动到这个段落上。</p>
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A