⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 12-12.html

📁 文件是《精通Javascript+jQuery》的书中实例
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>animate()方法</title>
<style type="text/css">
<!--
body{
	background:url(bg2.jpg);
}
div{
	background-color:#FFFF22; 
	width:100px; text-align:center;
	border:2px solid #000000;
	margin:3px; font-size:13px;
	font-family:Arial, Helvetica, sans-serif;
}
input{
	border:1px solid #000033;
}
-->
</style>
<script language="javascript" src="jquery.min.js"></script>
<script language="javascript">
$(function(){
	$("input:eq(0)").click(function(){
		//第一个animate与第二个animate同时执行,然后再执行第三个
		$("#block1").animate({width:"90%"},{queue:false,duration:1500})
		.animate({fontSize:"24px"},1000)
		.animate({borderRightWidth:"20px"},1000);
	});
	$("input:eq(1)").click(function(){
		//依次执行三个animate
		$("#block2").animate({width:"90%"},1500)
		.animate({fontSize:"24px"}, 1000)
		.animate({borderRightWidth:"20px"}, 1000);
	});
	$("input:eq(2)").click(function(){
		$("input:eq(0)").click();
		$("input:eq(1)").click();
	});
	$("input:eq(3)").click(function(){
		//恢复默认设置
		$("div").css({width:"", fontSize:"", borderWidth:""});
	});
});
</script>
</head>
<body>
	<input type="button" id="go1" value="Block1动画">
	<input type="button" id="go2" value="Block2动画">
	<input type="button" id="go3" value="同时动画">
	<input type="button" id="go4" value="重置">
	<div id="block1">Block1</div>
	<div id="block2">Block2</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -