animate()动漫效果重要的事灵活运用css
古。。2018-11-19 02:57:41238<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="jquery-3.3.1.js"></script>
<style type="text/css">
div{
height: 200px;
width: 200px;
background: blue;
position: absolute;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$('#bt1').click(function(){
$('p').animate({fontSize:"50px"},1500)//属性名称font-size都写成驼峰写法fontSize
})
$('#bt2').click(function(){
$('div').animate({//left:"500px"
//opacity:0.3;//透明度
//height:300px
//width:300px
////height:'toggle';
width:'toggle'
},1500)//属性名称font-size都写成驼峰写法fontSize
})
})
</script>
</head>
<body>
<button id="bt1">点击字体放大</button>
<p>jQuery中我们使用 animate()方法创建自定义的动画</p>
<button id="bt2">点击移动div</button>
<div></div>
</body>
</html>