为什么Ember.run afterRender不适用于CSS转换? [英] Why is Ember.run afterRender not working for CSS transitions?
本文介绍了为什么Ember.run afterRender不适用于CSS转换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Ember.run.scheduleOnce('afterRender')
但是,对我来说,它不工作,而不添加超时。这是在Ember 1.0.0
View = Em.View.extend({
didInsertElement:function(){
Ember.run.scheduleOnce('afterRender',this,'animateModalOpen');
},
animateModalOpen:function(){
//这不work-modal从类in中获取样式,没有转换
$('。modal')。addClass('in');
//这样做,转换被触发
setTimeout(function(){
$('。modal')。addClass('in');
},1);
}
},
});
这是以前工作的东西,只是没有了,还是我缺少的东西? / p>
解决方案
Ember.run.next
在这里工作非常好
didInsertElement:function(){
Ember.run.next(this,this.animateModalOpen) ;
}
From my understanding, one way to work with CSS transitions is to use Ember.run.scheduleOnce('afterRender')
However, for me it is not working without adding a timeout. This is in Ember 1.0.0
View = Em.View.extend({
didInsertElement: function() {
Ember.run.scheduleOnce('afterRender', this, 'animateModalOpen');
},
animateModalOpen: function() {
// this does not work - modal gets styles from class "in" with no transition
$('.modal').addClass('in');
// this does work, the transition is fired
setTimeout(function() {
$('.modal').addClass('in');
}, 1);
}
},
});
Is this something that used to work and just doesn't anymore, or am I missing something?
解决方案
Ember.run.next
has worked very well for me on this type of thing.
didInsertElement: function() {
Ember.run.next(this, this.animateModalOpen);
}
这篇关于为什么Ember.run afterRender不适用于CSS转换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文