Question

I am trying to implement turbolinks in my rails app, its an old app which has pretty huge codebase.

We use YUI and Jquery in our app. Now after integrating turbolinks in the app, the Dom ready event would not be triggered as per the turbolinks behavior.

Changing every place which calls YUI.util.event.onDOMReady is not a good option. I want to be able to trigger YUI's ready event on 'page:load' event

QUESTION

How do I trigger YUI's onDOMReady event after turbolinks 'page:load'

PS: Because of Turbolinks implementation page does not reload, it just replaces the content of body tag with the body tag in response somewhat like PJAX

Any help is highly apprciated

Was it helpful?

Solution

Just do :

Y._yuievt.events.domready.fired = false;
Y._yuievt.events.domready.fire();

You have to reset fired value of domready, because it's considered as single execution event.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top