87,921
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>quee.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
.newcolor {
background-color: red;
}
</style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function () {
$("div").click(function () {//没有点击,就没有执行下面的方法;其中$("div").queue就没有执行,所以无法获取特效方法队列
$("div").show("slow");//1运行
$("div").animate({left:'+=200'},2000);//2运行
$("div").queue(function () {//3运行
//alert(this.innerHTML);
$(this).addClass("newcolor");//为所有div的newcolor样式
$(this).dequeue();//4执行这个方法,就会移除队列中第一个特效函数$(this).show("slow");//1运行
//并执行这个特效
});
$("div").animate({left:'-=200'},500);//5运行
$("div").queue(function () {//6运行
//alert(this.innerHTML);
$(this).removeClass("newcolor");//删除newcolor
$(this).dequeue();//7运行,//2运行,并移除2$(this).animate({left:'+=200'},2000);
});
$("div").slideUp();
});
});
</script>
</head>
<body>
<div>abc</div>
</body>
</html>