react-lazy-load-image-component icon indicating copy to clipboard operation
react-lazy-load-image-component copied to clipboard

threshold doesnt work beyond -200px for mobile devices

Open dukesx opened this issue 4 years ago • 4 comments

Bug description The Threshold option doesn't work beyond -200px. What i mean is, that my pictures are of 400px height. I am trying to mimic Medium's way of loading images. Show placeholder to user then load. So, to do this, i need the threshold to load images only if viewport is showing full image , i.e threshold at -400px. Now for desktop, this works but if i change virtual device to mobile device in chrome debugger tools, it doesn't work. shows placeholder but doesnt load the real image. if i however keep threshold at -200px, it works for both.

To Reproduce Paste the code that is producing the issue

         <LazyLoadImage
            className="o-fit-cover"
           height={400}
          src={blocks.data.file.url}
          threshold={-200}
         effect="opacity"
         scrollPosition={props.scrollPosition}
         placeholderSrc={
         blocks.data.file.url.slice(
        0,
       blocks.data.file.url.length - 5
       ) + "-placeholder.webp"
      }
      style={{ width: 400, maxWidth: "100%" }}
      ></LazyLoadImage>

List any other actions needed to reproduce the issue:

consider this,

  • imagine image of 600px height and threshold above half its height, such as 320px and scroll towards the image vertically in mobile view

Expected behavior Image should start loading and show the real image (high res) as soon as i see the placeholder

Screenshots image

Technical details:

  • Package version- Latest
  • Server Side Rendering? Yes (Next-Js)
  • Device [Desktop/Smartphone] - Smartphone (google chrome virtual device)
  • Operating System (any)
  • Browser (Chrome/Edge/Firefox)

dukesx avatar Jul 14 '20 15:07 dukesx

Never mind I changed to a better library.

dukesx avatar Jul 18 '20 20:07 dukesx

@dukesx which is?

riccardolardi avatar Aug 12 '20 13:08 riccardolardi

@dukesx, care to share what library are you using now? I have similar problems and don't want to waste my time waiting for the author to fix this project. Thanks.

virtyaluk avatar Jan 07 '22 10:01 virtyaluk

Has anyone found another library?

monolithed avatar Sep 18 '23 11:09 monolithed