-1

Does backbone.js inherently have a way for me to detect and react to a views 'on show' and 'on hide'?

Or do I need to manually implement this using JQuery?

Emile Bergeron
  • 17,074
  • 5
  • 83
  • 129
sazr
  • 24,984
  • 66
  • 194
  • 362
  • Possible duplicate of [onHide() type event in jQuery](https://stackoverflow.com/questions/2857900/onhide-type-event-in-jquery) – Emile Bergeron Mar 29 '18 at 15:31
  • _"react to a views 'on show' and 'on hide"_, that doesn't exist out of the box on Backbone view, so you'd have to show us what you're using, or explain what you're talking about. – Emile Bergeron Mar 29 '18 at 15:32
  • @EmileBergeron essentially when a view (a page) is rendered I want to execute a series of animations. When we go to another page (view) we want to execute another animation. – sazr Mar 30 '18 at 14:51
  • So you want to call handler functions at different points in the animation process? Like when it starts, during the animation and when it ends? – Emile Bergeron Mar 30 '18 at 18:33

1 Answers1

0

"essentially when a view (a page) is rendered" this is not a built in feature of backbone. You are the one defining a render method, (if you even have one, backbone doesn't have a rule to have one) or whatever way in which your view renders, so backbone can't provide such event because it doesn't know how you render things.
So if you are using pure backbone you'll have to implement it according to how you render your views.

If you use something built on top of backbone like Marionette.js, then it has set rules about how view's are rendered, hence it can and does provide events as well as call backs such as onRender, onBeforeRender.

T J
  • 42,762
  • 13
  • 83
  • 138