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

Feature request: viewableThreshold above 1

Open Fumler opened this issue 7 years ago • 1 comments

Hello.

Great library! Just wondering if there are any plans to allow viewableThreshold to be more than 1? We would like to start loading our ads a bit before they are actually in the viewport.

A solution could be to just wrap the ad in a lazyload component, but seeing as you already have the logic for checking if its in the viewport I thought it might be better to allow for it in your component.

What do you think?

Fumler avatar Apr 18 '18 06:04 Fumler

I believe it would need to be a different property since viewableThreshold is a measure of the area of the ad within the viewable area. We'd need to measure the proximity of the ad to the viewable area. And I'm wondering if there are other use cases for determining ad-load intent.

Check out https://github.com/nfl/react-gpt/blob/22437553b50272b8d6221ed29f98da76c912eabd/src/Bling.js#L502 This is calling isInViewport (https://github.com/nfl/react-gpt/blob/17c8b89a05209135968bb9a3447274524f1b5925/src/utils/isInViewport.js)
I think we can riff of this and the logic is pretty simple, but I'm not sure overloading viewableThreshold makes sense. Will come back with proposal later today.

potench avatar Apr 19 '18 18:04 potench