From 55e776defe0fd07bc16c05f982d47a89d1bd5079 Mon Sep 17 00:00:00 2001 From: dixso Date: Sat, 19 Sep 2015 14:10:17 +0200 Subject: [PATCH] Bug fix full width. --- src/js/custombox.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/js/custombox.js b/src/js/custombox.js index 34a8d6c..a11e3f1 100644 --- a/src/js/custombox.js +++ b/src/js/custombox.js @@ -121,18 +121,6 @@ // Listeners. this.binds(); }, - zIndex: function() { - for ( var zIndex = 0, x = 0, elements = document.getElementsByTagName('*'), xLen = elements.length; x < xLen; x += 1 ) { - var val = window.getComputedStyle(elements[x]).getPropertyValue('z-index'); - if ( val ) { - val =+ val; - if ( val > zIndex ) { - zIndex = val; - } - } - } - return zIndex; - }, built: function( item ) { var cb; if ( typeof this.item !== 'undefined' ) { @@ -595,6 +583,8 @@ if ( this.cb[i].settings.width !== 'full' ) { this.cb[i].container.style.marginLeft = '5%'; this.cb[i].container.style.marginRight = '5%'; + } else if ( this.cb[i].content.offsetWidth <= window.innerWidth ) { + this.cb[i].content.style.width = 'auto'; } this.cb[i].container.style.width = 'auto'; this.cb[i].wrapper.style.width = window.innerWidth + 'px'; @@ -620,6 +610,12 @@ this.cb[i].container.style.marginTop = '5%'; this.cb[i].container.style.marginBottom = '5%'; } else { + if ( this.cb[i].settings.width === 'full' ) { + this.cb[i].settings.position[1] = 'top'; + if ( this.cb[i].content.offsetHeight <= window.innerHeight ) { + this.cb[i].content.style.height = window.innerHeight + 'px'; + } + } switch ( this.cb[i].settings.position[1].trim() ) { case 'top': result = 0;