diff --git a/docs/README.md b/docs/README.md index c3437e0..4d4a71e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -42,7 +42,7 @@ const homepageAdPage = new AdJS.Page(AdJS.Networks.DFP, { desktop: { from: 1200, to: Infinity }, }, refreshRateInSeconds: 1000, - offset: -100, + offset: 100, targeting: { example: 'true' }, } }); @@ -84,7 +84,7 @@ const el = document.findElementById('example'); const bannerAd = new homepageAdPage.Ad(el, { path: '/1234/example/homepage', - offset: -10, + offset: 10, }); ``` diff --git a/docs/lazy-load-plugin.md b/docs/lazy-load-plugin.md index 3efbead..2865e43 100644 --- a/docs/lazy-load-plugin.md +++ b/docs/lazy-load-plugin.md @@ -99,7 +99,7 @@ const ad = new page.createAd(el, { AutoRender ], - renderOffset: -100, + renderOffset: 100, autoLoad: true, }); ``` diff --git a/docs/spa.md b/docs/spa.md index 51d27e6..92dcfb7 100644 --- a/docs/spa.md +++ b/docs/spa.md @@ -58,7 +58,7 @@ const homepageAdPage = new AdJS.Page(DFPNetwork, { }); const bannerAd = new homepageAdPage.Ad('.bannerAd', { - offset: -10, + offset: 10, modules: [Banner], fixBannerInMs: 100, }); @@ -67,7 +67,7 @@ const boxUnitElements = document.getElementsByClass('ad'); const boxUnitAds = Array.prototype.map.call(boxUnitElements, (el, idx) => { const ad = new homepageAdPage.Ad(el, { - offset: -50, + offset: 50, sticky: true, }); }); diff --git a/package.json b/package.json index c894459..9b96f6a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "adjs", - "version": "2.0.0-beta.22", + "version": "2.0.0-beta.23", "description": "Ad Library to simplify and optimize integration with ad networks such as DFP", "main": "./core.js", "types": "./types.d.ts", diff --git a/src/utils/scrollMonitor.ts b/src/utils/scrollMonitor.ts index 66a774a..a3bdf55 100644 --- a/src/utils/scrollMonitor.ts +++ b/src/utils/scrollMonitor.ts @@ -88,7 +88,7 @@ class ScrollMonitor { private static evaulateCurrentViewability = (ad: IScrollMonitorRegisteredAd, windowHeight: number) => { const bounding = ad.element.getBoundingClientRect(); - const inView = (bounding.top + ad.offset) <= windowHeight && (bounding.top + bounding.height) >= 0; + const inView = (bounding.top - ad.offset) <= windowHeight && (bounding.top + bounding.height) >= 0; const fullyInView = bounding.top >= 0 && bounding.bottom <= windowHeight; if (fullyInView && !ad.fullyInView) {