dvschultz / 99problems

99 Problems and e-reader rendering are all of them
60 stars 3 forks source link

iBooks doesn't always shows images with display:none when changing to display:block or inline #56

Open sylbru opened 7 years ago

sylbru commented 7 years ago

It looks like iBooks considers the images are not worth loading if their display property is set as none. That means you can't hide the images and then show them selectively by changing their class name or style property (for example if you want to build an interactive image gallery with "previous" and "next" buttons).

A workaround I have found is to start without the display: none property, but with opacity:0 on the container. Then wait for 2 seconds and execute the JS function that will set the display: none and display: block property on the images, and set the container's opacity to 1 (possibly with a transition).

But there is one situation where the issue remains: when the user locks the iPad screen, some of the images that were hidden might be "unloaded" and thus show nothing but a blank page.