码迷,mamicode.com
首页 > 其他好文 > 详细

回调函数

时间:2015-07-05 09:28:40      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

首先有一个函数执行,在传出指定个数参数的参数之后,再传入一个函数,就会实现在之前那个函数执行完之后,在执行这个函数,这个函数为回调函数

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>回调函数</title>
<script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(function(){
    $(‘#box‘).mouseover(function(){
        $(this).animate({‘width‘:‘300px‘},500,function(){//当执行完前面的函数(宽度变为300),在执行这个匿名函数
            $(this).animate({‘height‘:‘300px‘},500)//高度变为300
        })
    })
})

</script>
<style type="text/css">
    #box{
        width:100px;
        height:100px;
        background: red;
    }
</style>    
</head>
<body>
<div id="box"></div>

    
</body>
</html>

 

回调函数

标签:

原文地址:http://www.cnblogs.com/lzzhuany/p/4621687.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!