jquery中hover方法作用是什么
时间:2021-11-19 来源:互联网
今天PHP爱好者为您带来jquery中hover方法规定当鼠标指针悬停在被选元素上时要运行的两个函数,其使用语法是“$(selector).hover(inFunction,outFunction)”。希望对大家有所帮助。
本文操作环境:windows7系统、jquery3.2.1版、DELL G3电脑
jquery中hover方法作用是什么?
jQuery hover() 方法:
hover() 方法规定当鼠标指针悬停在被选元素上时要运行的两个函数。
方法触发 mouseenter 和 mouseleave 事件。
注意: 如果只指定一个函数,则 mouseenter 和 mouseleave 都执行它。
语法
$(selector).hover(inFunction,outFunction)
调用:
$( selector ).hover( handlerIn, handlerOut )
等同以下方式:
$( selector ).mouseenter( handlerIn ).mouseleave( handlerOut );
注意:如果只规定了一个函数,则它将会在 mouseenter 和 mouseleave 事件上运行。
调用:
$(selector).hover(handlerInOut)
等同于:
$( selector ).on( "mouseenter mouseleave", handlerInOut );
参数
inFunction 必需。规定 mouseenter 事件发生时运行的函数。
outFunction 可选。规定 mouseleave 事件发生时运行的函数。
以上就是jquery中hover方法作用是什么的详细内容,更多请关注php爱好者其它相关文章!
-
NFT 的 2024:努力不想离场的图片们 2025-04-26
-
2025 以太坊生态叙事前瞻:从 Pectra 升级到 NFT 的市场焕新 2025-04-26
-
Doodles创始人Burnt Toast暗示将发币!NFT地板价暴涨89% 2025-04-26
-
老牌NFT项目CyberKongz收到韦尔斯通知:SEC试图破坏Web3游戏生态 2025-04-26
-
Mocaverse地板价突破2.9ETH 24小时涨幅高达79%!NFT回温? 2025-04-26
-
NFT市场OpenSea在开曼群岛注册基金会!社群猜是准备发币和空投 2025-04-26