jQuery ??? ?? ????? ??
jQuery ????? - animate() ???
jQuery animate() ???? ??? ?? ?????? ??? ? ?????.
??: ??
$(selector).animate({params},speed,callback);
?? params ????? ?????? ???? CSS ??? ?????.
??? ?? ????? ??? ?? ??? ?????. "??", "??" ?? ??? ?? ??? ? ????.
??? ?? ????? ?????? ??? ? ??? ??? ?????.
?? ???? ?? ??? 250??? ? ??? <div> ??? ???? ???? animate() ???? ??? ??? ?????.
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-3.1.1.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("div").animate({left:'250px'}); }); }); </script> </head> <body> <button>開始動畫</button> <p>默認(rèn)情況下,所有 HTML 元素的位置都是靜態(tài)的,并且無法移動。如需對位置進(jìn)行操作,記得首先把元素的 CSS position 屬性設(shè)置為 relative、fixed 或 absolute。</p> <div style="background:#98bf21;height:100px;width:100px;position:absolute;"> </div> </body> </html>
?: ????? ?? HTML ??? ??? ????? ??? ? ????. ??? ?? ????? ?? ??? CSS ?? ??? ??, ?? ?? ??? ???? ???!
jQuery animate() - ?? ?? ??
????? ?? ???? ?? ?? ??? ??? ??? ? ????.
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-3.1.1.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("div").animate({ left:'250px', opacity:'0.5', height:'150px', width:'150px' }); }); }); </script> </head> <body> <button>開始動畫</button> <p>默認(rèn)情況下,所有 HTML 元素的位置都是靜態(tài)的,并且無法移動。如需對位置進(jìn)行操作,記得首先把元素的 CSS position 屬性設(shè)置為 relative、fixed 或 absolute。</p> <div style="background:#98bf21;height:100px;width:100px;position:absolute;"> </div> </body>
?: animate() ???? ??? ? ????. ??? ?? CSS ??? ????? ???? ? ??? ??? ?? ????. animate()? ??? ? ?? ?? ??? Camel ???? ???? ???? ???. ?? ?? padding-left ?? paddingLeft? ???? ?? margin- ?? marginRight? ???? ???. ??? ?? ?? ?? jQuery ??????? ?? ?????? ???? ?? ????. ?? ?????? ???? ?? ?? jQuery.com?? ?? ????? ????? ?????? ???.
jQuery animate() - ?? ? ?? ??
?? ?? ??? ?? ????(?? ??? ?? ?? ??????). ? ?? += ?? -=? ???? ???.
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-3.1.1.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("div").animate({ left:'250px', height:'+=150px', width:'+=150px' }); }); }); </script> </head> <body> <button>開始動畫</button> <p>默認(rèn)情況下,所有 HTML 元素的位置都是靜態(tài)的,并且無法移動。如需對位置進(jìn)行操作,記得首先把元素的 CSS position 屬性設(shè)置為 relative、fixed 或 absolute。</p> <div style="background:#98bf21;height:100px;width:100px;position:absolute;"> </div> </body> </html>
jQuery animate() - ?? ??? ? ?? ??
?? ?? "??", "???" ?? "??"?? ?????? ?? ????.
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-3.1.1.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("div").animate({ height:'toggle' }); }); }); </script> </head> <body> <button>開始動畫</button> <p>默認(rèn)情況下,所有 HTML 元素的位置都是靜態(tài)的,并且無法移動。如需對位置進(jìn)行操作,記得首先把元素的 CSS position 屬性設(shè)置為 relative、fixed 或 absolute。</p> <div style="background:#98bf21;height:100px;width:100px;position:absolute;"> </div> </body> </html>
jQuery animate() - ??? ?? ??
????? jQuery? ?????? ?? ??? ??? ?????. ?, ?? ?? animate() ??? ??? ???? jQuery? ?? ??? ??? ???? "??" ???? ?????. ?? ?? ??? ????? ??? ??? ?????.
?: ?? ?? ?????? ??? ???? ??? ??? ??? ???? ????
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-3.1.1.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ var div=$("div"); div.animate({height:'300px',opacity:'0.4'},"slow"); div.animate({width:'300px',opacity:'0.8'},"slow"); div.animate({height:'100px',opacity:'0.4'},"slow"); div.animate({width:'100px',opacity:'0.8'},"slow"); }); }); </script> </head> <body> <button>開始動畫</button> <p>默認(rèn)情況下,所有 HTML 元素的位置都是靜態(tài)的,并且無法移動。如需對位置進(jìn)行操作,記得首先把元素的 CSS position 屬性設(shè)置為 relative、fixed 或 absolute。</p> <div style="background:#98bf21;height:100px;width:100px;position:absolute;"> </div> </body> </html>