jquery mousedown() method


  Translation results:

mouse

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

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

vi.catching mice; spying, secretly searching

down

英[daʊn] 美[daʊn]

adv. Down; (sitting, falling, lying) down; (indicating the limit of range or order) down to

prep. (from a height) down; (indicating position) below... ; (indicating direction) downward along; (indicating time) since

n. (bird's) feathers; fluff; soft hair; hair

vt. Put down; drink (especially in a big mouth or quickly); cause to fall; shoot down (enemy aircraft, etc.)

vi. Come down; descend; [often used in imperative sentences] go down; lie down

jquery mousedown() methodsyntax

Function:When the mouse pointer moves over the element and the mouse button is pressed, the mousedown event occurs. Unlike the click event, the mousedown event only requires the key to be pressed and does not need to be released to occur. The mousedown() method triggers the mousedown event, or specifies a function to run when the mousedown event occurs.

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

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

Parameters:

##ParametersDescriptionfunction Optional. Specifies a function to run when a mousedown event occurs.​

jquery mousedown() 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(){
  $("button").mousedown(function(){
    $("p").slideToggle();
  });
});
</script>
</head>
<body>
<p>这是一个段落。</p>
<button>切换</button>
</body>
</html>
Run instance »

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