![](/img/trans.png)
[英]mootools “fx.styles” and “addevent” equivalent in jquery
[英]Mootools 1.3 and Fx.Styles
我收到以下錯誤:
Fx.Styles is not a constructor`
在行:
new Fx.Styles(obj.element, {'duration' : this.options.display.fadeDuration}).start({'opacity':[1]});
那這個呢?
.scrollTo is not a function
Fx.Scroll仍然可用嗎?
我該如何解決? 我正在運行Mootools 1.3。 謝謝。
mootools 1.3中沒有 Fx.Styles
您應該使用Fx.Morph或Fx.Tween即
var myFx = new Fx.Morph(element, {/*options*/});
myFx.start({/*whatever*/});
編輯:您的代碼“已更新”
var myFxStyle = new Fx.Morph(obj.element, {'duration' : this.options.display.fadeDuration});
myStyleFx.start({'opacity':1});
從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);
類似的:
element.set("morph", {
duration: 200,
link: "cancel",
onComplete: function() {
this.element.destroy();
}
});
element.morph({
"opacity": [1,0],
"marginLeft": [0,-500]
});
要返回事件,只需檢索元素FX實例:
element.get("morph").removeEvents("complete").setOptions({
// new options...
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.