- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想让图像像心脏一样跳动。图像跳动3秒后,图像自动翻转1秒,然后图像再次跳动,无限 Action 。我可以让图像跳动,但还是不能让它在1秒后自动翻转。
这是我的html代码
<div class=center>
<div class="flip">
<div class="flip-child">
<div class="front">
<img src="<?php ABSPATH; ?>/wordpress/logo/logo.png" alt="front" />
</div>
<div class="back">
<a href="<?php ABSPATH; ?>/wordpress/menu.html"> <img src="<?php ABSPATH; ?>/wordpress/logo/back.png" alt="back" /> </a>
</div>
</div>
</div>
</div>
这是css脚本
body {
background: #fff;
}
.center {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.flip {
perspective:1000px;
}
.flip:hover .flip-child,
.flip.hover .flip-child {
transform:rotateY(180deg);
}
.flip,.front,.back{
width: 284px;
height: 284px;
}
.flip-child {
transition:.8s; /* flip */
transform-style:preserve-3d;
position:relative;
}
.front,
.back {
backface-visibility:hidden;
position:absolute;
top:0;
left:0;
}
.front {
z-index:2;
transform:rotateY(0deg);
}
.front img{
animation: blink 1s infinite;
}
.back {
transform:rotateY(180deg);
}
/* For Chrome, Safari, Opera */
@-webkit-keyframes blink {
0% {width: 284px; height: 284px; margin: -0.5px 0 0 -0.5px;}
20% {width: 280px; height: 280px; margin: 0 0 0 0;}
40% {width: 276px; height: 276px; margin: 0.5px 0 0 0.5px;}
60% {width: 272px; height: 272px; margin: 1px 0 0 1px;}
80% {width: 276px; height: 276px; margin: 0.5px 0 0 0.5px;}
100% {width: 280px; height: 280px; margin: 0 0 0 0;}
}
/* Standard Syntax */
@keyframes blink {
0% {width: 284px; height: 284px; margin: -0.5px 0 0 -0.5px;}
20% {width: 280px; height: 280px; margin: 0 0 0 0;}
40% {width: 276px; height: 276px; margin: 0.5px 0 0 0.5px;}
60% {width: 272px; height: 272px; margin: 1px 0 0 1px;}
80% {width: 276px; height: 276px; margin: 0.5px 0 0 0.5px;}
100% {width: 280px; height: 280px; margin: 0 0 0 0;}
}
最佳答案
添加以下javascript代码
var flip = document.querySelector('.flip');
var state = 0;
setInterval(function() {
state = (state + 1) % 4;
if(state == 0)
flip.classList.remove('hover')
else if(state == 3)
flip.classList.add('hover')
}, 1000)
如果你使用jquery,把它包起来
$(function() {
... code goes here
});
如果不使用 jquery(荣誉),那么要么确保 javscript 位于“.flip”元素下方,要么将其包装在
document.addEventListener('DOMContentLoaded', function() {
... code goes here
});
工作 fiddle
关于javascript - CSS - 在关键帧中触发悬停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36026066/
是否有一个 FFMPEG 命令,如果我们传递一个视频文件,在每个场景更改时它都应该为它生成一个关键帧。我理解的关键帧是视频的一系列文件(图像或视频)文件,可用于在视频悬停时播放。请让我们知道我们是否可
我正在切换我通过带有 JQuery 的 toggleClass 触发的一系列动画/过渡。 其中一个动画正在使用以下内容: .header { transition: all .3s ease-
我有一些图片可以在关键帧中很好地滚动 @-webkit-keyframes headImage /* Safari and Chrome */ { 0% {background:url(../imag
尝试用 jQuery 制作一个简单的重复关键帧动画 $(document).ready(function() { $('body').mouseover(function() {
我在 richard bradshaw 找到了一个关于 css3 transitions 的很好的教程,可以在 http://css3.bradshawenterprises.com/cfimg/ 我
我正在尝试使用@keyframes 为背景交换设置动画。背景是径向渐变。背景发生变化,但不是动画。 #mydiv { background: radial-gradient(circle at 90%
如果单击按钮 2,您将看到动画运行。但是,当我使用另一个功能对按钮进行更改(选中复选框以显示。隐藏按钮)时,动画会再次运行,就像再次按下一样。 如何防止每次单独的函数对按钮进行更改时触发动画?即在切换
所以我创建了图像生成器(生成 RGB 的非常简单的一个)我希望能够将一定数量的图像转换为 H264 关键帧+相关帧(lats 说 100)所以在生成的每 100 帧上我需要将它们编码为 H264 .怎
我一直在尝试自学一些带有关键帧的 css 动画,我正在尝试创建一些东西,其中有一个小方 block 落下,然后从那个方 block 中,一个矩形从左边突出,然后显示一些大约 8 秒后发短信,然后 re
我意识到我不能简单地通过用逗号分隔@keyframes mymove、@-moz-keyframes mymove 等来完成下面相同的代码。。为了让它们工作,我需要如下分别声明它们。 有什么方法可以将
恐怕有类似的问题,但我没有找到具体的解决方案,所以我创建了一个 fiddle : http://jsfiddle.net/Garavani/yrnjaf69/2/ TEXT
我有一个包含多个坐标的图像映射。但是,当我在上面放置一个关键帧 div (clouds) 时,这个不起作用,因为动画覆盖了 map 。最后一个 div 是一个动画,有一些云从图像上掠过。 html代码
所以我正在尝试为元素创建 Wifi 闪烁效果。首先圆圈应该是可见的,然后是上面的圆圈,依此类推。在所有符号都可见后,它应该等待 2 秒,然后重新开始。你可以在这里看到我的当前状态: http://js
我试图在单击按钮时显示一条消息。我想要“GO!”淡入/淡出表示游戏开始,但只有在单击开始按钮时才会出现。我现在正在尝试使用 jquery 和另一个来自老师的库的 javascript,它结合了鼠标点击
我正在尝试使用以下代码让对象在背景中从左向右浮动。不幸的是,当它离开屏幕时,尽管向类添加了 overflow-y: hidden 属性,但仍会出现垂直滚动条。我尝试了百分比(100% 与过渡)但它没有
我正在为将鼠标悬停在图形图像上时的弹跳效果创建关键帧。我的一切都正常工作,但是一旦动画完成..图标就会消失。 我知道它与电子邮件中设置的 translateY 属性有关,并在类里面链接。 在悬停时,我
你好我正在尝试模拟翻转倒数计时器但是当我编写代码时我发现两者之间存在差异: @keyframes zindex { 0% { z-index: 2; } 5% { z-index: 4
如果我有: @keyframes animateleft{from{left:-300px;opacity:0} to{left:0;opacity:1}} 是否可以: @keyframes anim
我有一个弹出窗口,它在单击按钮时打开,然后在您单击另一个按钮或弹出窗口之外时关闭。我希望弹出窗口在打开时淡入并在关闭时淡出。如何使用 javascript 在两个关键帧之间切换? 我尝试通过使用 ja
我正在尝试使用 jquery Keyframes用于动态创建的关键帧动画。我的页面上有六个图标(可能更多),它们都需要设置为以下范围内的随机 x 和 y 值的动画: x = 1-5y = 13-20
我是一名优秀的程序员,十分优秀!