js监听transition过渡事件
html
<div id="mydiv">
</div>
style
#mydiv{
width:100px;
height:100px;
background:red;
-webkit-transition: width 2s ease-in-out;
transition: width 2s ease-in-out;
}
#mydiv:hover{
width:400px;
}
js
document.getElementById("mydiv").addEventListener("transitionend",function(e){
this.innerHTML="过渡事件触发--过渡以完成"
})
上面的例子,当鼠标覆盖div时,触发transition过渡效果,将宽度变为400px。
然后js监听了div的过渡效果的结束事件,当过渡效果结束时,往当前元素(div)添加文本内容。
当然,还可以监听,过渡事件的开始,进行,结束事件,分别为transitionstart、transitionrun、transitionend。
js监听transition过渡事件的更多相关文章
- JS监听关闭浏览器事件
Onunload与Onbeforeunload Onunload,onbeforeunload都是在刷新或关闭时调用,可以在<script>脚本中通过window.onunload来指定或 ...
- js监听浏览器关闭事件
html : <HTML> <HEAD> <title>test</title> </HEAD> <body onbefore ...
- js 监听组合键盘事件
有些时候,我们需要在网页上,增加一些快捷按键,方便用户使用一些常用的操作,比如:保存,撤销,复制.粘贴等等. 我们所熟悉的按键有这么集中类型: 单独的按键操作,如:delete.up.down等 两位 ...
- js监听页面copy事件添加版权信息
个人博客 地址:http://www.wenhaofan.com/article/20180921103346 1.介绍 当页面需要做版权保护时,比如当用户copy我们网站的文章时,我们会希望在他co ...
- js 监听输入框输入事件兼容ie7
$(element).bind("input propertychange",function(){});
- js监听浏览器返回事件
$(function(){ pushHistory(); window.addEventListener("popstate", function(e) { window.loca ...
- js监听浏览器后退事件
$(document).ready(function(e) { var counter = 0; if (window.history && ...
- ActiveX(二)Js 监听 ActiveX中的事件
在上一篇随笔:ActiveX(一)第一个简单的Demo 中,已经可以实现 js 单向调用 ActiveX 中的方法,在很多情况下ActiveX中的方法的执行时相对耗时.耗性能的.在这样的情况下.Act ...
- js 监听整个页面的回车事件
JS监听整个页面的回车事件 <script type="text/javascript"> document.onkeydown=keyDownSearch; ...
随机推荐
- jdbc插入mysql时间差14个小时的解决方案
在java中new Date()输出的时间是没错的,插入到mysql后少了14个小时,原因是新版jdbc驱动的时区设置问题. 在jdbc连接url最后加上serverTimezone=GMT%2B8即 ...
- maven工程下整合spring+mybatis报Mapped Statements collection does not contain value for spring-mybatis-user-get错误
在整合spring+mybatis报了下面的错误: Mapped Statements collection does not contain value for spring-mybatis-use ...
- .net get set用法
在早期学习c#的过程中,经常遇到这样的语句: public string StudentName{ get{return stuName;} set{stuNa ...
- 解决sql "Compatibility_199_804_30003" 和 "SQL_Latin1_General_CP1_CI_AS" 之间的排序规则冲突。
关联条件加 COLLATE Compatibility_199_804_30003
- 手把手教你搭建FastDFS集群(上)
手把手教你搭建FastDFS集群(上) 本文链接:https://blog.csdn.net/u012453843/article/details/68957209 FastDFS是一个 ...
- 分库分布的几件小事(五)MYSQL读写分离
1.为什么进行读写分离 这个,高并发这个阶段,那肯定是需要做读写分离的,啥意思?因为实际上大部分的互联网公司,一些网站,或者是app,其实都是读多写少.所以针对这个情况,就是写一个主库,但是主库挂多个 ...
- 【Git的基本操作三】基本操作命令
基本操作 (1) 状态查看操作 git status 作用:查看工作区.暂存区状态 (2) 添加操作 git add [filename] 作用:将工作区文件的 添加/修改,添加到暂存区 (3) 提交 ...
- Python学习记录1-基础知识
基础知识 基础 #简单记录了部分基础知识 #普通的打印字符串 >>> print("hello world") hello world ------------- ...
- springboot集成redis使用redis作为session报错ClassNotFoundException类RememberMeServices
springboot 集成redis使用redis作为缓存,会报错的问题. 错误信息: java.lang.IllegalStateException: Error processing condit ...
- npm run build后如何打开index.html跑起项目
Tip: built files are meant to be served over an HTTP server. Opening index.html over file:// won't ...