Backbone Marionette - Add a visual effect when switching view

后端 未结 5 574
半阙折子戏
半阙折子戏 2020-12-23 18:16

Is there a convenient way to add an effect when I leave a page (close a view/layout) and open a new one in the same region ? (something like a fade effect)

5条回答
  •  一向
    一向 (楼主)
    2020-12-23 18:30

    This seems to work for me:

    this.views = {
        messageItem: Marionette.ItemView.extend({
            template: Handlebars.templates.messaging_item,
            tagName: "li",
            className: "messaging-item",
            render: function(){
                this.$el.html(this.template(this.model.attributes));
                this.$el.hide();
            },
            onShow: function(){
                this.$el.slideDown(800);
            }
        })
    };
    

提交回复
热议问题