mousedown(fn)
在每一个匹配元素的mousedown事件中绑定一个处理函数。
mousedown事件在鼠标在元素上点击后会触发
Binds a function to the mousedown event of each matched element.
The mousedown event fires when the pointing device button is pressed over an element.
定义和用法
当鼠标指针移动到元素上方,并按下鼠标按键时,会发生 mousedown 事件。
与 click 事件不同,mousedown 事件仅需要按键被按下,而不需要松开即可发生。
mousedown() 方法触发 mousedown 事件,或规定当发生 mousedown 事件时运行的函数。
返回值
jQuery
参数
fn(Function) : 在每一个匹配元素的mousedown事件中绑定的处理函数。
实例
当按下鼠标按钮时,隐藏或显示元素:
$("button").mousedown(function(){ $("p").slideToggle();});
将函数绑定到 mousedown 事件
语法
$(
selector).mousedown(
function)
