Skip to content

Commit 8313902

Browse files
committedJun 3, 2015
Merge pull request Pikaday#298 from IS-smcleod/master
Fix how the width of the popup is calculated.
2 parents 6a260bd + c8610b2 commit 8313902

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed
 

Diff for: ‎pikaday.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -877,13 +877,19 @@
877877

878878
adjustPosition: function()
879879
{
880+
var field, pEl, width, height, viewportWidth, viewportHeight, scrollTop, left, top, clientRect;
881+
880882
if (this._o.container) return;
881-
var field = this._o.trigger, pEl = field,
882-
width = this.el.offsetWidth, height = this.el.offsetHeight,
883-
viewportWidth = window.innerWidth || document.documentElement.clientWidth,
884-
viewportHeight = window.innerHeight || document.documentElement.clientHeight,
885-
scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop,
886-
left, top, clientRect;
883+
884+
this.el.style.position = 'absolute';
885+
886+
field = this._o.trigger;
887+
pEl = field;
888+
width = this.el.offsetWidth;
889+
height = this.el.offsetHeight;
890+
viewportWidth = window.innerWidth || document.documentElement.clientWidth;
891+
viewportHeight = window.innerHeight || document.documentElement.clientHeight;
892+
scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
887893

888894
if (typeof field.getBoundingClientRect === 'function') {
889895
clientRect = field.getBoundingClientRect();
@@ -916,7 +922,6 @@
916922
top = top - height - field.offsetHeight;
917923
}
918924

919-
this.el.style.position = 'absolute';
920925
this.el.style.left = left + 'px';
921926
this.el.style.top = top + 'px';
922927
},

0 commit comments

Comments
 (0)
Please sign in to comment.