請問:1問:noww和fxx接收的是哪兩個參數(shù),沒有定義fxx這個函數(shù)啊。是怎么調(diào)用的?
<!DOCTYPE?html> <html> <head> ????<meta?http-equiv="Content-type"?content="text/html;?charset=utf-8"?/> ????<title></title> ????<style> ????p?{ ????????color:?red; ????} ???? ????div?{ ????????width:?200px; ????????height:?100px; ????????background-color:?yellow; ????????color:?red; ????} ????a{ ????????display:?block ????} ????</style> ????<script?src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script> </head> <body> ????<h2>animate(下)</h2> ????<p>慕課網(wǎng),專注分享</p> ????<div?id="aaron">內(nèi)部動畫</div> ????點擊觀察動畫效果: ????<select?id="animation"> ????????<option?value="1">動畫step動畫</option> ????????<option?value="2">動畫progress回調(diào)</option> ????</select> ????<a></a> ????<input?id="exec"?type="button"?value="執(zhí)行動畫"> ????<script?type="text/javascript"> ????$("#exec").click(function()?{ ????????var?v?=?$("#animation").val(); ????????var?$aaron?=?$("#aaron"); ????????if?(v?==?"1")?{ ????????????//觀察每一次動畫的改變 ????????????$aaron.animate({ ????????????????height:?'50' ????????????},?{ ????????????????duration?:2000, ????????????????//每一個動畫都會調(diào)用 ????????????????step:?function(noww,?fxx)?{?? ???????????????????$aaron.text('高度的改變值:'+noww)? ????????????????} ????????????}) ????????}?else?if?(v?==?"2")?{ ????????????//觀察每一次進度的變化 ????????????$aaron.animate({ ????????????????height:?'50' ????????????},?{ ????????????????duration?:20000, ????????????????//每一步動畫完成后調(diào)用的一個函數(shù), ????????????????//無論動畫屬性有多少,每個動畫元素都執(zhí)行單獨的函數(shù)? ????????????????progress:?function(now,?fx)?{ ???????????????????$aaron.text('進度:'+arguments[2]) ????????????????????//?var?data?=?fx.elem.id?+?'?'?+?fx.prop?+?':?'?+?now;? ????????????????????//?alert(data) ????????????????} ????????????}) ????????}? ????}); ????</script> </body> </html>
請問:1問:noww和fxx接收的是哪兩個參數(shù),沒有定義fxx這個函數(shù)啊。是怎么調(diào)用的?
2問:arguments[1]的值是怎么來的?改成arguments[2]顯示的數(shù)值又什么值?改成arguments[3]后顯示undefined說明數(shù)組里面只有三個值,這三值分別是什么?懵逼了,求大神解答!拜謝?。?!
2017-01-05
noww接收的是每次動畫時height的值,fxx是指每個動畫的每一步完成之后要執(zhí)行的函數(shù). step自動執(zhí)行的這個函數(shù).
?arguments對象是比較特別的一個對象,實際上是當前函數(shù)的一個內(nèi)置屬性。arguments非常類似Array,但實際上又不是一個Array實例.arguments對象的長度是由實參個數(shù)而不是形參個數(shù)決定的。形參是函數(shù)內(nèi)部重新開辟內(nèi)存空間存儲的變量,但是其與arguments對象內(nèi)存空間并不重疊.
也就是說此時的arguments[1]代表的是progress的進度,而它是從0-1的,0代表開始,1代表結束
2017-06-22
keyi !
2017-01-06
加油,共同努力進步