2013-09-22 36 views
0

如何使我的骨幹幻燈片 - 中的骨幹視圖動畫中的骨幹視圖

var View = Backbone.View.extend({ 

    el : "#editor",    // Bind to the editor id 

    render : function() { 

    var data = { 
     item: this.model, 
     _: _ 
    }; 

    var compiledTemplate = _.template(Template, data); // Merge model with template 
    this.$el.html(compiledTemplate); 
    this.$('.editor-pane').show(500);  // Does animation work here...NO!! Urgh. 
    return this; 
    } 
}); 

是一些動畫。 #editor包含。編輯窗格

林也樂於與#editor元件上的版本:

 this.$el.html(compiledTemplate).show ('slow'); 

回答

-1

嘗試在另一個方法移動動畫並運行它渲染後。此外,我建議使用jQuery的「查找」的方法來瀏覽DOM。

initialize: function(){ 
    ... 
    this.render(); 
    this.animateView(); 
} 

animateView: function(){ 
    this.$el.find('.editor-pane').show(500); 
} 
+0

纔有可能以觸發事件{'onload事件 –