thom
thom

Reputation: 21

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.

Upvotes: 2

Views: 3009

Answers (2)

Dimitar Christoff
Dimitar Christoff

Reputation: 26165

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...
});

Upvotes: 2

stecb
stecb

Reputation: 14766

there is no Fx.Styles in mootools 1.3

You should use Fx.Morph or Fx.Tween i.e.

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});

Upvotes: 4

Related Questions