-1

我正在尝试使用 fx.morph 显示我的导航,代码如下:

 var fx = new Fx.Morph(_element, { 
     duration: 1000,transition:Fx.Transitions.Sine.easeOut
                                 });
 fx.start({
          'height': [0, 100]
           });
 }

它运作良好,我需要将高度从 0 设置为自动而不是 0 到 100。有什么解决方案可以做到这一点吗?我尝试自动和 100%,但它没有用。

4

1 回答 1

0

我自己做了。我只是添加一个容器,然后计算该容器的高度,然后将其作为高度。

    var _element = el.getElement('.child_first_nav_mobile');
            if (_element) {

                var fx = new Fx.Morph(_element, { duration: 1000 });
                var autoheightdiv = _element;
                autoheightdiv.style.height='auto';
                var calcheight=autoheightdiv.offsetHeight
                fx.start({
                    'height': [0, calcheight] 
                    });
于 2015-07-21T15:02:43.197 回答