开发者

Mootools 1.3 and Fx.Styles

I get the follow开发者_JS百科ing 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 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});


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜