jquery中hover方法作用是什么
时间:2022-02-11 17:18
jquery中hover方法规定当鼠标指针悬停在被选元素上时要运行的两个函数,其使用语法是“$(selector).hover(inFunction,outFunction)”。 本文操作环境:windows7系统、jquery3.2.1版、DELL G3电脑 jquery中hover方法作用是什么? jQuery hover() 方法: hover() 方法规定当鼠标指针悬停在被选元素上时要运行的两个函数。 方法触发 mouseenter 和 mouseleave 事件。 注意: 如果只指定一个函数,则 mouseenter 和 mouseleave 都执行它。 语法 调用: 等同以下方式: 注意:如果只规定了一个函数,则它将会在 mouseenter 和 mouseleave 事件上运行。 调用: 等同于: 参数 inFunction 必需。规定 mouseenter 事件发生时运行的函数。 outFunction 可选。规定 mouseleave 事件发生时运行的函数。 推荐学习:《jquery视频教程》 以上就是jquery中hover方法作用是什么的详细内容,更多请关注gxlsystem.com其它相关文章!$(selector).hover(inFunction,outFunction)
$( selector ).hover( handlerIn, handlerOut )
$( selector ).mouseenter( handlerIn ).mouseleave( handlerOut );
$(selector).hover(handlerInOut)
$( selector ).on( "mouseenter mouseleave", handlerInOut );