简体   繁体   English

Mootools 1.3和Fx.Styles

[英]Mootools 1.3 and Fx.Styles

I get the following error: 我收到以下错误:

Fx.Styles is not a constructor`

at line: 在行:

new Fx.Styles(obj.element, {'duration' : this.options.display.fadeDuration}).start({'opacity':[1]});

And what about this one? 那这个呢?

.scrollTo is not a function

Is Fx.Scroll still available? Fx.Scroll仍然可用吗?

How could I solve that? 我该如何解决? I'm running Mootools 1.3. 我正在运行Mootools 1.3。 Thank you. 谢谢。

there is no Fx.Styles in mootools 1.3 mootools 1.3中没有 Fx.Styles

You should use Fx.Morph or Fx.Tween ie 您应该使用Fx.Morph或Fx.Tween即

var myFx = new Fx.Morph(element, {/*options*/});
myFx.start({/*whatever*/});

Edit: your code 'renewed' 编辑:您的代码“已更新”

var myFxStyle = new Fx.Morph(obj.element, {'duration' : this.options.display.fadeDuration});
myStyleFx.start({'opacity':1});

since 1.2 these have been also available as element shortcuts (as steweb says, Fx.Styles deprecated, so Fx.Tween and Fx.Morph as exported into elements upon request, much easier): 从1.2开始,这些也可以用作元素快捷方式(如steweb所说,已弃用Fx.Styles,因此,根据要求将Fx.Tween和Fx.Morph导出为元素非常容易):

element.set("tween", {
    duration: 200,
    onComplete: function() {
        this.element.destroy();
    }
});

element.tween("opacity", newvalue);
// or even use .fade which shortcuts this:

element.fade(0); 
// or
element.fade(.7, 0);

similarly: 类似的:

element.set("morph", {
    duration: 200,
    link: "cancel",
    onComplete: function() {
        this.element.destroy();
    }
});

element.morph({
    "opacity": [1,0],
    "marginLeft": [0,-500]
});

to access events back, just retrieve the element FX instance: 要返回事件,只需检索元素FX实例:

element.get("morph").removeEvents("complete").setOptions({
     // new options...
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM