Adrien Glitchbone
Adrien Glitchbone

Reputation: 111

Backbone Marionette onBeforeClose and transitions

I'm new to Backbone Marionette since yesterday, and I was wondering if anyone alredy tried to implement some fancy transitions between views.

Actually, I'm trying to fadeout my current view before rendering the next one. I'm doing this in the onBeforeClose callback, but this is not working as thé next view renders before my current view has finished transitioning...

Any tips?

Thanks

Upvotes: 3

Views: 2527

Answers (2)

Marcin Krysiak
Marcin Krysiak

Reputation: 11

I think this could be useful for you.

The following marionette plugin that adds 4 kind of transitions. There can be easily added more transition types.

Basically instead of using yourRegion.show(view)... you can use now yourRegion.showAnimated(view, {animationType: 'yourAnimation'});

it's very easy to use.

https://github.com/marcinkrysiak1979/marionette.showAnimated

see the documentation on github for more info

Upvotes: 0

Derick Bailey
Derick Bailey

Reputation: 72858

This should have made it in to Marionette a long time ago, but I kept putting it off...

https://github.com/marionettejs/backbone.marionette/issues/320#issuecomment-9746319

This is the core of the code that you'll need to do transition animations with a region. The code in that issue calls a "fadeout" and "fadein" method on the views directly, but you would just call view.$el.fadeIn(...) and fadeout instead.

I've used this a number of times with great success, and I built it with friend of mine who is using it in a massively scaled app as well.

Upvotes: 5

Related Questions