简体   繁体   中英

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?

How could I solve that? I'm running Mootools 1.3. Thank you.

there is no Fx.Styles in mootools 1.3

You should use Fx.Morph or Fx.Tween ie

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):

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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