這篇文章主要介紹了jquery隊(duì)列函數(shù)用法,以實(shí)例形式分析了jQuery中隊(duì)列的用法以及控制樣式的技巧,具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
本文實(shí)例講述了jquery隊(duì)列函數(shù)用法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
復(fù)制代碼代碼如下:
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery-1.9.1.js"></script>
</head>
<body>
<style>
div { margin:3px; width:40px; height:40px;
position:absolute; left:0px; top:30px;
background:green; display:none; }
div.newcolor { background:blue; }
</style>
Click here...
<div></div>
<script>
$(document.body).click(function () {
$("div").show("slow");
//$("div").slideDown();
$("div").animate({left:'+=200'},2000);
$("div").queue(function () {//入隊(duì)列
$(this).addClass("newcolor");
$(this).dequeue();//出隊(duì)列
});
$("div").animate({left:'-=200'},2000);
$("div").queue(function () {//入隊(duì)列
$(this).removeClass("newcolor");
$(this).dequeue();//出隊(duì)列
});
$("div").slideUp();
});
</script>
</body>
</html>
希望本文所述對大家jQuery程序設(shè)計(jì)的學(xué)習(xí)有所幫助。