博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jquery悬停_jQuery悬停()
阅读量:2531 次
发布时间:2019-05-11

本文共 2076 字,大约阅读时间需要 6 分钟。

jquery悬停

jQuery hover() function fires when the mouse pointer enters and leaves the selected HTML element. jQuery hover function will attach two event handlers to execute when the mouse enters and leaves the element.

当鼠标指针进入并离开选定HTML元素时,jQuery hover()函数将触发。 jQuery悬停功能将附加两个事件处理程序,以在鼠标进入和离开元素时执行。

jQuery悬停 (jQuery hover)

The hover() method attaches handlers for mouse enter and mouse leave events.

hover()方法为鼠标进入和鼠标离开事件附加处理程序。

The syntax for using hover():

使用hover()的语法:

  • hover(handlerIn, handlerOut)

    悬停(handlerIn,handlerOut)

handlerIn is a function to execute when the mouse enters the html element and handlerOut function executes when the mouse leaves the element.

handlerIn是一个在鼠标进入html元素时执行的函数, handlerOut函数在鼠标离开该元素时执行。

  • hover (handlerInOut)

    悬停(handlerInOut)

Using this you can attach a single handler – handlerInOut that will execute with the mouse enter and mouse leave events. This function is shorthand for $( selector ).on( "mouseenter mouseleave", handlerInOut );.

使用此方法,您可以附加一个处理程序– handlerInOut ,该处理程序将与鼠标enter和鼠标离开事件一起执行。 此函数是$( selector ).on( "mouseenter mouseleave", handlerInOut );

jQuery悬停示例 (jQuery hover example)

Following example demonstrates jQuery hover() function usage.

下面的示例演示jQuery hover()函数的用法。

jQuery hover 
Enter JournalDev

In this example, you can see the hover() function is attached with two handlers – append() method is the function executed when you enter the element and it will append a <span> element. When you leave the element find() method finds the <span> element and it’s removed from the parent element, which is the <div> element in this example.

在此示例中,您可以看到hover()函数附加了两个处理程序– append()方法是在您输入元素时执行的函数,它将追加一个<span>元素。 当您离开元素时,find()方法将找到<span>元素,并将其从父元素中删除,该父元素在本示例中为<div>元素。

Below is the output of above HTML page, just hover over it and notice the jQuery hover function in action.

下面是上面HTML页面的输出,将鼠标悬停在上面,并注意到jQuery悬停功能正在起作用。

That’s all for a simple jQuery hover() function example, it’s a very useful method for creating great animation and effects.

这就是一个简单的jQuery hover()函数示例的全部,这对于创建出色的动画和效果是非常有用的方法。

翻译自:

jquery悬停

转载地址:http://edlzd.baihongyu.com/

你可能感兴趣的文章
万方数据知识平台 TFHpple +Xpath解析
查看>>
Hive实现oracle的Minus函数
查看>>
秒杀多线程第四篇 一个经典的多线程同步问题
查看>>
RocketMQ配置
查看>>
vs code调试console程序报错--preLaunchTask“build”
查看>>
蚂蚁金服井贤栋:用技术联手金融机构,形成服务小微的生态合力
查看>>
端口号大全
查看>>
机器学习基石笔记2——在何时可以使用机器学习(2)
查看>>
POJ 3740 Easy Finding (DLX模板)
查看>>
MySQL 处理重复数据
查看>>
关于typedef的用法总结(转)
查看>>
【strtok()】——分割字符串
查看>>
Linux下安装rabbitmq
查看>>
曹德旺
查看>>
【转】判断点在多边形内(matlab)
查看>>
java基础之集合:List Set Map的概述以及使用场景
查看>>
Python 线程 进程 协程
查看>>
iOS语言中的KVO机制
查看>>
excel第一次打开报错 向程序发送命令时出错 多种解决办法含终极解决方法
查看>>
响应式web设计之CSS3 Media Queries
查看>>