jQuery animate函数初始化值 [英] jquery animate function initialize the value

查看:75
本文介绍了jQuery animate函数初始化值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$(element).delay(2000).animate(
    {
        scale: 1,
    },
    {
        duration: 1000,
        step: function(now) {
            scaleVal = now;
            $(element).attr("transform", "translate(" + centerX + " " + centerY + ") scale(" + scaleVal + ") translate(" + (-centerX) + " " + (-centerY) + ")");
        }
    }
);

现在小数位值从0开始并以1结尾,但是我想从0.5开始并以1结尾.

Now the scale value starts from 0 and ends up in 1 but instead of this I want to start from 0.5 and ends up in 1.

如何在动画功能中初始化缩放比例值?

How can I initialize the scale value in animate function?

推荐答案

您需要使用css函数

$(ele).css('scale', 0.5).animate({scale:1});

这篇关于jQuery animate函数初始化值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆