diff --git a/polymer-overlay/polymer-overlay.html b/polymer-overlay/polymer-overlay.html index dc20994..9259da3 100644 --- a/polymer-overlay/polymer-overlay.html +++ b/polymer-overlay/polymer-overlay.html @@ -248,6 +248,13 @@ focusOverlay(); } }, + positionTarget: function() { + var computedStyle = getComputedStyle(this.target); + if (this.opened && computedStyle.top === 'auto' && computedStyle.bottom === 'auto') { + this.target.style.width = (window.innerWidth - 20) + 'px'; + this.target.style.top = ((window.innerHeight - this.target.getBoundingClientRect().height) / 2) + 'px'; + } + }, renderOpened: function() { this.target.classList.remove('closing'); this.target.classList.add('revealed'); @@ -256,6 +263,7 @@ this.asyncMethod('continueRenderOpened'); }, continueRenderOpened: function() { + this.positionTarget(); this.target.classList.toggle('opened', this.opened); this.target.classList.toggle('closing', !this.opened); this.animating = this.asyncMethod('completeOpening', null, this.timeout);