react-lazyload icon indicating copy to clipboard operation
react-lazyload copied to clipboard

not working if container element is in fullscreen mode

Open joenzhu opened this issue 4 years ago • 1 comments

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

joenzhu avatar May 17 '21 08:05 joenzhu

  1. 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.

kyoungholee avatar May 22 '24 08:05 kyoungholee