已经下载下来,你拆开看一下就知道了。
说说原理,这里并不是纯css3,,只是用css3定义好动画,
@-moz-keyframes tips {
0% {box-shadow: 0px 0px 0px #f00}
25% {box-shadow: 0px 0px 8px #f00}
50% {box-shadow: 0px 0px 0px #f00}
100% {box-shadow: 0px 0px 8px #f00}
}
然后,js在切屏后,用Js来触发这一个样式,这个样式调用了刚才定义的动画。
.tips {
-webkit-animation:tips 1s
-moz-animation:tips 1s
}
当然css3是可以做的,只是用纯css3,就没办法像这样可以拖动切屏,这个是需要js或者jq来完成。。。
~如果你认可我的回答,请及时点击【采纳为满意回答】按钮
~~手机提问的朋友在客户端右上角评价点【满意】即可。
~你的采纳是我前进的动力
~~O(∩_∩)O,记得好评和采纳,互相帮助,谢谢。
捕获阶段在 DOM 树的某个节点发生了一些 *** 作(例如单击、鼠标移动上去),就会有一个事件发射过去。这个事件从 Window 发出,不断经过下级节点直到目标节点。在到达目标节点之前的过程,就是捕获阶段(Capture Phase)。
所有经过的节点,都会触发这个事件。捕获阶段的任务就是建立这个事件传递路线,以便后面冒泡阶段顺着这条路线返回 Window。
监听某个在捕获阶段触发的事件,需要在事件监听函数传递第三个参数 true。
element.addEventListener(<event-name>, <callback>, true)
但一般使用时往往传递 false,会在后面说明原因。
<!DOCTYPE html><html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
* {margin: 0 padding: 0}
.rect {
width: 100px
height: 100px
background-color: #f80
-webkit-transition: all .5s
}
</style>
<script>
window.onload = function () {
var _rect = document.querySelector('.rect')
_rect.onclick = function () {
_rect.style.webkitTransform = 'translateX(300px)'
}
_rect.addEventListener('webkitTransitionEnd', function () {
alert('动画执行完毕!')
// callback here
}, false)
}
</script>
</head>
<body>
<div class="rect"></div>
</body>
</html>
简单的不用js就行
<!DOCTYPE HTML><html>
<head>
<meta charset= "utf8">
<title>untitled</title>
<link rel = "stylesheet" type = "text/css" href = "">
<style type = "text/css">
*{
margin: 0px
padding: 0px
}
#a{
position: absolute
width: 50px
height: 50px
background-color: #f3e9e0
border-radius: 50%
left: 400px
top: 200px
}
#a div{
position: absolute
width: 50px
height: 50px
border-radius: 50%
transition: all 0.5s
left: 0px
top: 0px
}
#a :nth-child(1){
background-color: #c1d4ed
}
#a :nth-child(2){
background-color: #7d6e69
}
#a :nth-child(3){
background-color: #dad6d5
}
#a :nth-child(4){
background-color: #caaa9d
}
#a :nth-child(5){
background-color: #6bdeff
}
#a:hover :nth-child(1){
left: 150px
top: -150px
}
#a:hover :nth-child(2){
left: 150px
top: 150px
}
#a:hover :nth-child(3){
left: 300px
top: -150px
}
#a:hover :nth-child(4){
left: 300px
top: 150px
}
#a:hover :nth-child(5){
left: 450px
top: 0px
}
</style>
</head>
<body>
<div id = 'a'>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</body>
</html>
鼠标伸到球上 自动扩散移动
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)