by default it gets triggered by any anchor tag, so to ignore it for a certain link you will have to add data-turbolinks=”false” to that anchor.
you have to specify on which element you want it to be triggered & you can even specify more than one trigger for more than one container,
ofcourse you can make pjax handle all links “same as TurboLinks” and dump the page content into the “body” but you will be missing the main reason why you would be using it over TurboLinks
will replace the whole body content, so something like a soundcloud player in the footer wont persist playing between pages.
in order for anything to be loaded into the main page (incase of using a templating system) from the visited link, it have to be inside the container.
you structure your code as normal using things like “@include, @stack, etc..” and it will be added exactly where you want it (even inside the header tag).
with something like “@stack” unless its inside the container, it wont work, which creates a muddy code and wrong html render.
- if you have any js code that needs to be loaded after a link visit, you need to re-initiate it under the “turbolinks:render” event
- because of how its currently created, sometimes you would get duplicated items (mainly js files) in the head https://github.com/turbolinks/turbolinks/issues/154
- when you visit a cached page, you would get a flicker and thats because TL first show the cached preview then refresh to the one rendered by the server, so to avoid this behavior, use https://github.com/turbolinks/turbolinks#opting-out-of-caching
- you cant specify a part to be ignored on a visit ex.”soundcloud player” https://github.com/turbolinks/turbolinks/issues/156
- if you have any js code that needs to be loaded after a link visit, you need to re-initiate it under the “pjax:success” event
- just like TL, pjax use caching so incase u have an issue about some duplication in content https://github.com/defunkt/jquery-pjax/issues/632, use $.pjax.defaults.maxCacheLength = 0
- needs jQuery, however you can instead try https://github.com/MoOx/pjax which doesn’t rely on it.
- in both, you can inline any js code inside your template and it will be executed as usual
“as long as any required js library your code may need has already been loaded on the page visit”.