Skip to content

Commit

Permalink
Merge pull request #66 from theonion/bug/use-window-innerwidth
Browse files Browse the repository at this point in the history
  • Loading branch information
dannypcheng authored Jun 19, 2018
2 parents 64ec5b5 + 0456a28 commit f091eb1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var AdManager = function (options) {
this.adId = 0;
this.initialized = false;
this.viewportWidth = 0;
this.oldViewportWidth = window.document.body.clientWidth;
this.oldViewportWidth = window.innerWidth;
this.options = utils.extend(defaultOptions, options);
this.bindContext();

Expand Down Expand Up @@ -90,7 +90,7 @@ AdManager.prototype.handleWindowResize = function () {
return;
}

this.viewportWidth = window.document.body.clientWidth;
this.viewportWidth = window.innerWidth;

if (!this.oldViewportWidth || this.oldViewportWidth !== this.viewportWidth) {
// viewport size has actually changed, reload ads
Expand Down Expand Up @@ -314,7 +314,7 @@ AdManager.prototype.generateId = function () {
* @returns {Integer} client width in pixels
*/
AdManager.prototype.getClientWidth = function () {
return window.document.body.clientWidth;
return window.innerWidth;
};

/**
Expand Down

0 comments on commit f091eb1

Please sign in to comment.