Skip to content

Commit 66f468f

Browse files
authored
2.0.0-beta.23 (#96)
* [MM] Invert scroll monitor offset (#96)
1 parent ba4ac77 commit 66f468f

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const homepageAdPage = new AdJS.Page(AdJS.Networks.DFP, {
4242
desktop: { from: 1200, to: Infinity },
4343
},
4444
refreshRateInSeconds: 1000,
45-
offset: -100,
45+
offset: 100,
4646
targeting: { example: 'true' },
4747
}
4848
});
@@ -84,7 +84,7 @@ const el = document.findElementById('example');
8484

8585
const bannerAd = new homepageAdPage.Ad(el, {
8686
path: '/1234/example/homepage',
87-
offset: -10,
87+
offset: 10,
8888
});
8989
```
9090

docs/lazy-load-plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const ad = new page.createAd(el, {
9999
AutoRender
100100
],
101101

102-
renderOffset: -100,
102+
renderOffset: 100,
103103
autoLoad: true,
104104
});
105105
```

docs/spa.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const homepageAdPage = new AdJS.Page(DFPNetwork, {
5858
});
5959

6060
const bannerAd = new homepageAdPage.Ad('.bannerAd', {
61-
offset: -10,
61+
offset: 10,
6262
modules: [Banner],
6363
fixBannerInMs: 100,
6464
});
@@ -67,7 +67,7 @@ const boxUnitElements = document.getElementsByClass('ad');
6767

6868
const boxUnitAds = Array.prototype.map.call(boxUnitElements, (el, idx) => {
6969
const ad = new homepageAdPage.Ad(el, {
70-
offset: -50,
70+
offset: 50,
7171
sticky: true,
7272
});
7373
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "adjs",
3-
"version": "2.0.0-beta.22",
3+
"version": "2.0.0-beta.23",
44
"description": "Ad Library to simplify and optimize integration with ad networks such as DFP",
55
"main": "./core.js",
66
"types": "./types.d.ts",

src/utils/scrollMonitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class ScrollMonitor {
8888
private static evaulateCurrentViewability = (ad: IScrollMonitorRegisteredAd, windowHeight: number) => {
8989
const bounding = ad.element.getBoundingClientRect();
9090

91-
const inView = (bounding.top + ad.offset) <= windowHeight && (bounding.top + bounding.height) >= 0;
91+
const inView = (bounding.top - ad.offset) <= windowHeight && (bounding.top + bounding.height) >= 0;
9292
const fullyInView = bounding.top >= 0 && bounding.bottom <= windowHeight;
9393

9494
if (fullyInView && !ad.fullyInView) {

0 commit comments

Comments
 (0)