<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>:animated</title>
<style>
div {
width:300px;
height:300px;
background-color: lightgreen;
}
</style>
</head>
<script src="jquery-3.1.1.js">
</script>
<body>
<!--:animated 匹配所有正在执行动画效果的元素-->
<button id="run">Run</button>
<div></div>
</body>
<script type="text/javascript">
$('#run').click(function(){
$("div:not(:animated)").animate({ width: "+=30" }, 5000);
});
</script>
</html>jQquery :animated 给没有动画效果的元素添加动画
最新推荐文章于 2024-08-30 10:25:23 发布
本文介绍了一个使用jQuery的:animated选择器来控制动画效果的简单示例。通过按钮点击触发动画,仅当目标元素未处于动画状态时才执行宽度变化。

6万+

被折叠的 条评论
为什么被折叠?



