国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > JavaScript > 正文

jQuery 回調(diào)函數(shù)(callback)的使用和基礎(chǔ)

2019-11-20 13:06:18
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

還是先貼代碼吧

復(fù)制代碼 代碼如下:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script src="js/jquery.js"></script>
    </head>
<style>
body{font-family: "微軟雅黑";width: 980px; margin: 0 auto; text-align: center;}
    .box{
        width: 300px;
        height: 300px;
        background: green;
        border: 1px solid #e6e6e6;
        margintop: 50px;
        line-height: 200px;
        position: absolute;
    }
button{
    border: none;
    background: green;   
    width: 100px;
    height: 50px;
    line-height: 50px;
    color: #fff;
    font-size: 16px;
    margin-top: 50px;
    }
</style>
    <body>
        <button>點(diǎn)擊開(kāi)始動(dòng)畫(huà)</button>
        <div class="box" ></div>
        <script>
            $(document).ready(function(){
              $("button").click(function(){
                var div=$(".box");
                div.animate({height:'200px',opacity:'0.4'},"slow");
                div.animate({width:'200px',opacity:'0.8'},"slow");
                div.animate({height:'100px',opacity:'0.4'},"slow");
                div.animate({width:'100px',opacity:'0.8'},"slow");
                div.animate({right:'100px',opacity:'0.8'},"slow");
                div.animate({bottom:'100px',opacity:'0.8'},"slow");
                div.animate({left:'100px',opacity:'0.8'},"slow");
                div.animate({top:'100px',opacity:'0.8'},"slow",function(){
                    alert("The paragraph is over");
                });
              });
            });
        </script>
        <script>
            $(document).ready(function(){
                $("button").click(function(){
                    var div=$(".box");
                        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",function(){
                    alert("The paragraph is over");
                    });
                    });
                });
            });
        </script>
    </body>
</html>

所謂的回調(diào)函數(shù),其實(shí)就是在 speed 或 duration 參數(shù)可以設(shè)置許多不同的值,比如 "slow", "fast", "normal" 或毫秒  后面再添加函數(shù),顯示相對(duì)應(yīng)的內(nèi)容,以提示網(wǎng)民

小伙伴們對(duì)jQuery回調(diào)函數(shù)是否有了新的認(rèn)識(shí)了呢,希望本文能給大家一些幫助。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 屏山县| 加查县| 克东县| 收藏| 乌鲁木齐县| 镇远县| 涞水县| 白山市| 乃东县| 台安县| 洪江市| 庐江县| 竹北市| 建宁县| 新田县| 靖远县| 墨玉县| 荆州市| 香港 | 峨边| 锡林浩特市| 广昌县| 九龙城区| 大邑县| 山阴县| 陆丰市| 西吉县| 涿鹿县| 闻喜县| 临安市| 黄浦区| 舟曲县| 南投县| 安乡县| 柘荣县| 岑巩县| 色达县| 观塘区| 贡嘎县| 珲春市| 新巴尔虎右旗|