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()函数的用法。

<!DOCTYPE html>
<html>
<head>
<title>jQuery hover</title>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script>
$(document).ready(function(){$("div").hover(function() {$( this ).append( $( "<span> : Now You are a Super *****</span>" ) );}, function() {$( this ).find( "span:last" ).remove();}
);
});
</script><style>
.divClass1
{padding:5px;text-align:center;background-color:yellow;border:solid 1px;
}span {color: red;
}
</style>
</head>
<body><div class="divClass1">Enter JournalDev</div></body>
</html>

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()函数示例的全部,这对于创建出色的动画和效果是非常有用的方法。

翻译自: https://www.journaldev.com/4964/jquery-hover

jquery悬停

jquery悬停_jQuery悬停()相关推荐

  1. jQuery制作鼠标悬停水平滑动门切换特效仿阿里妈妈联盟广告切换特效

    原文:jQuery制作鼠标悬停水平滑动门切换特效仿阿里妈妈联盟广告切换特效 源代码下载地址:http://www.zuidaima.com/share/1607128309009408.htm

  2. jquery教程_jQuery教程

    jquery教程 I have written a lot of jQuery tutorial articles. This is an index post for all the jQuery ...

  3. html5鼠标悬停图片放大的原理,jQuery当鼠标悬停时放大图片的效果实例

    这个效果最初源于小敏同志的一个想法,刚开始做的时候只能实现弹出的图片是固定的,不能随鼠标移动,最后加以改善,终于实现了比较理想的效果.今天就把制作该效果的经验与大家一同分享.先看看最终效果演示: HT ...

  4. 基于jQuery的鼠标悬停时放大图片的效果制作

    这是一个基于jQuery的效果,当鼠标在小图片上悬停时,会弹出一个大图,该大图会跟随鼠标的移动而移动.这个效果最初源于小敏同志的一个想法,刚开始做的时候只能实现弹出的图片是固定的,不能随鼠标移动,最后 ...

  5. 【jQuery】鼠标悬停事件

    jQuery鼠标悬停触发弹出框1 运用mouseover与mouseout事件实现鼠标的悬停触发事件 <!DOCTYPE html> <html> <head>&l ...

  6. jQuery九宫格鼠标悬停动画效果

    2019独角兽企业重金招聘Python工程师标准>>> 效果描述: 网页常见的win8平面颜色效果,这里用到了 当鼠标悬停在其中一个格子中,会有小小的动画效果 这是我遇到的第一个使用 ...

  7. html中鼠标悬停时间,jQuery悬停鼠标悬停/鼠标时间

    我在 freakyleaf.co.uk/hoverfade/处有以下实例,当将鼠标悬停在图块上时,图块背景图像在600毫秒(.tile_img)上淡化1到0.25不透明度,然后文本在500毫秒(.ov ...

  8. ajax鼠标悬停,mouseout后触发jQuery Ajax鼠标悬停事件

    这种情况正在发生,因为当鼠标已离开节点时,ajax请求尚未完成.它只会做它的事情,等待服务器的响应,然后显示你的成功函数中定义的工具提示. 解决这个问题的一种方法是拥有一个变量,比如isHoverin ...

  9. jQuery mouseover 鼠标悬停事件

    转载自:https://blog.csdn.net/LY9457/article/details/79658645    https://blog.csdn.net/LY9457/article/de ...

最新文章

  1. archlinux安装小记
  2. 在疫情防控一线,技术能发挥什么作用?
  3. Java将异常入库_Exception异常库
  4. 通过案例对 spark streaming 透彻理解三板斧之三:spark streaming运行机制与架构
  5. Android权限【大全】 .
  6. Inspeckage,安卓动态分析工具
  7. ruby打印_Ruby程序打印一个数字的乘法表
  8. 实战HTML5与CSS3 第一篇】初探水深,美丽的导航,绚丽的图片爆炸!!
  9. 高效率实现web自动完成功能-三叉搜索树
  10. [英语]工作邮件中超实用的100句英文
  11. 设计模式学习02:简单工厂模式、工厂模式以及抽象工厂模式(具体)
  12. 【C/C++】C++基本语法
  13. 【云周刊】第200期:云栖专辑 | 阿里开发者们的第6个感悟:享受折磨
  14. C语言程序书写中 每行必须有分号,C语言课后习题答案
  15. Kodak Preps 8 for Mac(专业拼版软件)
  16. DaSiamRPN、SiamRPN++论文阅读
  17. 操作系统(02326)自考学习笔记/备考资料
  18. PointNetGPD: Detecting Grasp Configurations from Point Sets
  19. 【PDF转换图片】如何把pdf文件转换成图片?如何把批量pdf文件转换成图片?如何把多目录批量pdf文件转换成图片?如何pdf文件转换成图片不失真不损失清晰度?今天教方法
  20. cisco将计算机配置为vlan2,思科路由器如何配置VLAN的IP

热门文章

  1. 各浏览器的Hack写法【转】
  2. [软件更新]Mozilla Firefox 3.0.11
  3. 不可磨灭的记忆 CPU发展史经典回顾
  4. Sql 语句:显示 Sql Server 中所有表中的信息
  5. Web文件管理原码.rar
  6. [转载] python学习笔记——@property装饰器
  7. [转载] python中set函数是什么数据类型_Python基本数据类型-list-tuple-dict-set详解
  8. [转载] Python基础:用Python统计列表中每个单词出现的次数(split 的使用,for双重循环)
  9. 史上最细的FIFO最小深度计算,(大多数笔试题中都会涉及)
  10. 对va_list; va_start ; va_end ;vsprintf理解(转)