jquery-animate基本用法


//点击DIV移动

function btnMoveClick() {
    $("#div1").stop(true, true);
    var vleft = $("#div1").position().left;
    var vtop = $("#div1").position().top;
    var vwidth = $("#div1").width;
    var vheight = $("#div1").height;
    $("#div1").animate({ "top": "25px", "left": "200px", "height": "20px", "width": "20px", "border-radius": "10px" }, 2000, function () {
        $("#div1").animate({ "top": "25px", "left": "0px" }, 2000, function () {
            $("#div1").animate({ "top": "50px", "left": "400px", "height": "50px", "width": "50px", "border-radius": "0px" }, 2000, function () {
                $("#div1").css({
                    "top": vtop,
                    "left": vleft,
                    "height": vheight,
                    "width": vwidth
                })
            });
        })
    });


    //$(this).animate({ "top": "200px", "left": "200px" }, 2000, function () {
    //    $(this).animate({ "top": "0px", "left": "400px" }, 2000);
    //});
}

原文地址:https://www.cnblogs.com/cxd1008/p/6372441.html