有一齿轮,现在做的动画是,鼠标悬浮时才会触发滚动事件,
想做的动画是,页面加载完成后,隔一段时间齿轮会自己滚出去再滚回来。
向右滚动和向左滚动都能实现,但是不知道jquery中怎么写“隔一段时间+滚出去再滚回来”
html:
<div id="wheel1">
<p>Running right</p>
</div>
<div id = "wheel2">
<p>Running left</p>
</div>
css:
<style type="text/css">
#wheel1{
width: 150px;
height: 150px;
background-color: pink;
border:5px dotted purple;
border-radius: 80px;
float: right;
}
#wheel2{
width: 150px;
height: 150px;
background-color: pink;
border:5px dotted purple;
border-radius: 80px;
}
#wheel2:hover{
transform: translate(1000px) rotate(720deg);
transition: transform 8s ease;
}
#wheel1:hover{
transform: translate(-500px) rotate(-720deg);
transition: transform 8s ease;
}
p{
font-size: 25px;
color: white;
margin: 30px;
}