Skip to content
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

not working if container element is in fullscreen mode #355

Open
JoenZhu opened this issue May 17, 2021 · 1 comment
Open

not working if container element is in fullscreen mode #355

JoenZhu opened this issue May 17, 2021 · 1 comment

Comments

@JoenZhu
Copy link

JoenZhu commented May 17, 2021

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

@kyoungholee
Copy link

  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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants