abstract:<button id="right">右移</button> <button id="stop">停止</button> <div class="box1"> php中文網(wǎng)</div> <script> $(doc
<button id="right">右移</button> <button id="stop">停止</button> <div class="box1"> php中文網(wǎng)</div> <script> $(document).ready(function(){ $('.but1').click(function(){ $('p').animate({fontSize:'40px'},1500)//屬性名稱(chēng)font-size 一律改成駝峰寫(xiě)法:fontSize }) //同時(shí)操作多個(gè)css屬性 //使用預(yù)定義的值 show hide toggle $('.but2').click(function(){ $('div').animate({ // left:'400px',//如果想對(duì)元素位置進(jìn)行一個(gè)位移,那么我們需要給當(dāng)前元素設(shè)置一個(gè)position例如: // opacity:'0.3', // height:'400px', // width:'400px' width:'toggle' },1500) }) $('#right').click(function(){ $('.box1').animate({left:'+500px'},3000) $('.box1').animate({fontSize:'30px'},500) }) $('#stop').click(function(){ $('.box1').stop(true) }) }) </script> 總結(jié):animate使用前習(xí)慣性寫(xiě)上.stop(),立即完成動(dòng)畫(huà),達(dá)到友好體驗(yàn)
Correcting teacher:天蓬老師Correction time:2019-04-22 13:56:08
Teacher's summary:現(xiàn)在有很多優(yōu)秀的動(dòng)畫(huà)庫(kù), 可以實(shí)現(xiàn)更多的功能 ,還有css3中也自帶了很多原生的物效....
jQuery中的很多效果,都可以用這些替代的