react-lazyload
react-lazyload copied to clipboard
not working if container element is in fullscreen mode
My code just like this
function A () {
const [imgs] = React.useState(Array(20).fill('').map((_, i) => i))
const fullscreen = React.useCallback(() => {
const container = document.querySelector('#container');
container.requestFullscreen();
}, []);
return (
<div id="container" onClick={fullscreen}>
{imgs.map((img, index) => (
<LazyLoad height={200}> key={index}>
<Img />
</LazyLoad>
))}
</div>
)
}
when container element on fullscreen mode, LazyLoad will not working
- Using the scrollContainer Properties You can use the scrollContainer attribute to specify which elements LazyLoad detects scroll events, which works in full-screen mode as LazyLoad calculates visibility within a particular element.
<LazyLoad scrollContainer="#container" height={200} key={index}> <Img /> </LazyLoad>
Please insert the id to scroll through.