Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
}
});
Expand Down Expand Up @@ -84,7 +84,7 @@ const el = document.findElementById('example');

const bannerAd = new homepageAdPage.Ad(el, {
path: '/1234/example/homepage',
offset: -10,
offset: 10,
});
```

Expand Down
2 changes: 1 addition & 1 deletion docs/lazy-load-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const ad = new page.createAd(el, {
AutoRender
],

renderOffset: -100,
renderOffset: 100,
autoLoad: true,
});
```
4 changes: 2 additions & 2 deletions docs/spa.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const homepageAdPage = new AdJS.Page(DFPNetwork, {
});

const bannerAd = new homepageAdPage.Ad('.bannerAd', {
offset: -10,
offset: 10,
modules: [Banner],
fixBannerInMs: 100,
});
Expand All @@ -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,
});
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/scrollMonitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down