DEV Community 👩‍💻👨‍💻

Shshank
Shshank

Posted on

Laravel Livewire Turbolinks with Image lazyload

I am building a website on laravel livewire. I've impimented turbolinks and to speed up the website, I am trying Vanilla LazyLoad everything is working fine until I switch pages using links.

Website is working like a SPA as expected, but when I switch page from home to any other page of same website and back to home, I ends up with dummy low quality image which is switched by lazyload on page load. I mean, when the page loaded or refreshed, I'll see dummy low quality images, which then switched to original images, but when I visit link using turbolinks images do not switch.

Anyone has any idea on this? Or any other suggestion to lazyload image in livewire turbolinks.

Thanks

Top comments (1)

Collapse
 
shshank profile image
Shshank Author

Got the solution, any one in future browses this posts. Please re-init your js on turbolink:load

Visualizing Promises and Async/Await 🤯

async await

☝️ Check out this all-time classic DEV post