商品飞入购物车代码

来源:互联网 发布:kali linux中文输入法 编辑:程序博客网 时间:2024/05/01 01:44

var gtPlay = {
            begin: Array(0, 0), end: Array(0, 0), PicID: 0, Num: 0, Time: 0, HandW: Array(0, 0, 0, 0),
            stime: function () {
                return this.Time / this.Num;
            },
            anmte: function (h) {
                $("#" + this.PicID + h).animate({
                    top: this.end[0],
                    left: this.end[1],
                    width: this.HandW[2],
                    height: this.HandW[3]
                }, 1000, "linear", function () {
                    $("#" + this.PicID + h).remove();
                    $(".dilog-cart").addClass("dilog-cart-bg");
                });
            },
            Play: function () {
                $("img[name=gtPlayname]").remove()
                for (var i = 0; i < this.Num; i++) {
                    $("<img id='" + this.PicID + i + "' src='" + $("#" + this.PicID).attr("src") + "' name='gtPlayname' style='clear:both; z-index:999; position:fixed; width:" + this.HandW[0] + "; height:" + this.HandW[1] + "; top:" + this.begin[0] + ";left:" + this.begin[1] + ";'/>").appendTo("body");
                    setTimeout("gtPlay.anmte(" + i + ")", i * parseInt(this.stime()))
                }
            }
        }

        gtPlay.begin = Array("0px", "0px"); //起飞开始位置 Top,Left
        gtPlay.end = Array($(window).height(), "20px");//目标位置 目标位置Top,Left 带上
        gtPlay.PicID = "ctoid1"; //飞动图片ID

        gtPlay.Num = 1; //飞动数量
        gtPlay.Time = 100; //飞行耗时 过短可能肉眼看不到
        gtPlay.HandW = Array($(window).width(), "180px", parseInt($(window).width()) * 0.1, "18px");//图像变化大小

0 0
原创粉丝点击