Javascript 将属性对象传递给jQuery动画函数

Javascript 将属性对象传递给jQuery动画函数,javascript,jquery,object,parameters,jquery-animate,Javascript,Jquery,Object,Parameters,Jquery Animate,我有一段代码: var delta = _window.width() / 30, // resize hexagons by delta px window_height = _window.height(); // .box-1/window height $('.hexagon').each(function () { // get animated boxes var $this = $(this), width_1 = $this.width(),

我有一段代码:

var delta = _window.width() / 30, // resize hexagons by delta px
window_height = _window.height(); // .box-1/window height

 $('.hexagon').each(function () { // get animated boxes
    var $this = $(this),
        width_1 = $this.width(),
        height_1 = $this.height(),
        multi = 0, // adjust resize to scroll speed (depends on delta)
        ratio = 1.167; // to calculate height

    // animation properties
    var enlarge_obj = {
            width: function() {return width_1 += (delta * multi)},
            height: function() {return width_1 * ratio}
        },
        shrink_obj = {
            width: function() {return width_1 -= (delta * multi)},
            height: function() {return width_1 * ratio}
        };


        ....


        function scrollHandler() {
            ...
            $this.animate(enlarge_obj, 0, 'linear');
            ...
            $this.animate(shrink_obj, 0, 'linear');
        }
}
我想把放大和缩小对象传递给jQuery动画函数

但它不起作用

如果我写这样的代码:

$this.animate({width: width_1 += (delta * multi), height: width_1 * ratio},0,'linear');
它很好用。
我做错了什么?Thx.

是否从
$中调用动画功能。每个
?控制台中有错误吗?是的,每个循环中都有错误。console中没有错误。jQuery不会为函数设置动画,而是为数字设置动画