css3菜单动画效果求助

css3菜单动画效果求助,第1张

将animation2改为

@-webkit-keyframes animation2{

    from{margin-left:0}

    to{margin-left:185pxopacity:1}

}

@-moz-keyframes animation2{

    from{margin-left:0}

    to{margin-left:185pxopacity:1}

}

不知道你要做什么,无聊写个js吧

<html>

<body>

<div id="container" style="width:800pxbackground-color:#8C7D65height:100%margin:0 auto">

<div id="fly-item" style="width:20pxheight:20pxborder-radius:10pxbackground-color:blackposition:absolutemargin-top:30%">

</div>

</body>

<script>

var obj = document.querySelector("#fly-item")

var fly_distance = 0

var journey = 780

var interval = setInterval(function(){

fly_distance += 1

obj.style.marginLeft = (fly_distance + "px")

if(fly_distance >= journey) {

clearInterval(interval)

alert("到终点了")

}

},10)

</script>

</html>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/11320266.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-15
下一篇 2023-05-15

发表评论

登录后才能评论

评论列表(0条)

保存