首页  >  文章  >  web前端  >  jQuery 回调函数(callback)的使用和基础_jquery

jQuery 回调函数(callback)的使用和基础_jquery

WBOY
WBOY原创
2016-05-16 16:12:521303浏览

还是先贴代码吧

复制代码 代码如下:



   
       
       
       
   

   
       
       

        <script> <br /> $(document).ready(function(){<br /> $("button").click(function(){<br /> var div=$(".box");<br /> div.animate({height:'200px',opacity:'0.4'},"slow");<br /> div.animate({width:'200px',opacity:'0.8'},"slow");<br /> div.animate({height:'100px',opacity:'0.4'},"slow");<br /> div.animate({width:'100px',opacity:'0.8'},"slow");<br /> div.animate({right:'100px',opacity:'0.8'},"slow");<br /> div.animate({bottom:'100px',opacity:'0.8'},"slow");<br /> div.animate({left:'100px',opacity:'0.8'},"slow");<br /> div.animate({top:'100px',opacity:'0.8'},"slow",function(){<br /> alert("The paragraph is over");<br /> });<br /> });<br /> });<br /> </script>
        <script><br /> $(document).ready(function(){<br /> $("button").click(function(){<br /> var div=$(".box");<br /> div.animate({height:'300px',opacity:'0.4'},"slow");<br /> div.animate({width:'300px',opacity:'0.8'},"slow");<br /> div.animate({height:'100px',opacity:'0.4'},"slow");<br /> div.animate({width:'100px',opacity:'0.8'},"slow",function(){<br /> alert("The paragraph is over");<br />      });<br /> });<br /> });<br /> });<br /> </script>
   

所谓的回调函数,其实就是在 speed 或 duration 参数可以设置许多不同的值,比如 "slow", "fast", "normal" 或毫秒  后面再添加函数,显示相对应的内容,以提示网民

小伙伴们对jQuery回调函数是否有了新的认识了呢,希望本文能给大家一些帮助。

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn