twobin / react-lazyload

Lazy load your component, image or anything matters the performance.
MIT License
5.85k stars 487 forks source link

Updated scrollContainer processing logic #340

Open ShiiRochi opened 3 years ago

ShiiRochi commented 3 years ago

In this PR I've updated the logic of the scrollport final value processing using the passed scrollContainer prop.

If scrollContainer is a string it will be used in querySelector, but if none corresponding element is found, it will fall back to window.

If scrollContainer is an instance of an HTMLElement, it will be used as is without any query.

In other cases, when arrays, numbers, nulls, etc are passed, scrollport will stick to its default value [window].