I am using Rails with turbolinks. I want to trigger some script on load
page event. The problem is that TL does not fire this event on page navigation. This log does not happen on page navigation:
window.addEventListener('load', (event) => {
console.log('load');
});
It get fire on full page refresh. But that does not helps.
My goal is to scroll on certain #id (using anchor at the end of link) after all content of the page loads (mainly images). Without this event images change scroll positions after fully images loaded.
Github to something about it. For example this link: https://github.com/uBlockOrigin/uBlock-issues/issues/338#issuecomment-452847292 will scroll to the comment even though there is image just before it.
Is there away to achieve this using TL or any other way?
To install behavior, or to perform more complex operations when the page changes, avoid script elements and use the
turbolinks:load
event instead
source https://github.com/turbolinks/turbolinks
For older versions page:change
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.