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-pane

我对#editor 元素上的版本也很满意:

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

1 回答 1

-1

尝试以另一种方法移动动画并在渲染后运行它。我还建议使用 jQuery 'find' 方法来浏览 DOM。

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

animateView: function(){
    this.$el.find('.editor-pane').show(500);
}
于 2013-09-24T12:26:41.940 回答