-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preload Image #184
Comments
@kiranavaibe React-reader uses epubjs under the hood, and this will load the whole chapter into the dom, and as long as the img-tags not having loading=lazy the browser should start loading images for the current chapter. In this screenshot i navigate to a new chapter, and in the network-tab 2 images are loaded. The last one will appear on 2 pages ahead. |
@gerhardsletten Thanks for the response! Yes, I understand that images load on page navigation. However, likely due to the image size, there’s a brief white screen before the image appears. I’m wondering if there’s any technique to preload an image in advance to reduce that white screen time. |
In this example it shows how to hook into the dom of the iframe where content is rendered: https://github.com/gerhardsletten/react-reader/blob/main/src/examples/DisableContextMenu.tsx In the same way you could try to hook into each image and display a loader until all is loaded https://stackoverflow.com/questions/11071314/javascript-execute-after-all-images-have-loaded |
Hi @gerhardsletten ,
I have an EPUB with some images, and during page navigation, it takes a while to load and display the images, resulting in a white screen. Do you have any ideas on how to preload images to eliminate the loading time?
The text was updated successfully, but these errors were encountered: