Views
One of the hardest things with a pushstate navigation is to handle and take care of all the Javascript states/events in the different pages.
Barba.js gives a nice helper that will help you to associate a Container
with a View
.
All the transitions need to extend the Barba.BaseView object.
To associate a View
with a Container
, it's enough to specify a common namespace:
It's suggested to .init() the Views before calling Pjax.start() - In this way Pjax.start() will emit onEnter() and onEnterCompleted() for the current view.
If you don't like data-namespace you can change it, see the Dom API section.