Chrome fix

This commit is contained in:
斟酌 鵬兄 2015-10-01 00:44:02 +08:00
parent c328231f76
commit 86605da37a
2 changed files with 16 additions and 2 deletions

View File

@ -48,6 +48,7 @@
/* This is to hide the scrollbar */ /* This is to hide the scrollbar */
padding-right: 50%; padding-right: 50%;
margin-right: -50%; margin-right: -50%;
overflow-x: hidden;
overflow-y: scroll; overflow-y: scroll;
} }

View File

@ -101,6 +101,16 @@
m_style.minHeight = m_style.opacity = m_style.height = 0; m_style.minHeight = m_style.opacity = m_style.height = 0;
// The interval in firefox seems independent to etablishing element style // The interval in firefox seems independent to etablishing element style
// using heightTriggers-hack instead // using heightTriggers-hack instead
var by = function( el )
{
var tRect = el.getBoundingClientRect();
return tRect.y || tRect.top;
};
var bh = function( el )
{
var tRect = el.getBoundingClientRect();
return tRect.height;
};
Trigger.height( Trigger.height(
this.mbox, 0 this.mbox, 0
, function() , function()
@ -115,10 +125,13 @@
m_style.marginTop = ( -0.5 * mHeight ) + "px"; m_style.marginTop = ( -0.5 * mHeight ) + "px";
m_style.opacity = 1; m_style.opacity = 1;
if( mHeight < ( bBox.getBoundingClientRect().y - bBox.previousSibling.getBoundingClientRect().y + bBoxHeight ) ) if( Math.floor( mHeight ) < Math.floor( by( bBox ) - by( bBox.parentNode ) + bBoxHeight ) )
{ {
m_style.height = "100%"; m_style.height = "100%";
this.innerBox.style.maxHeight = ( innerHeight - bBoxHeight ) + "px" var resultH = innerHeight - bBoxHeight;
var maxResultH = mHeight - bBoxHeight - by( this.innerBox ) + by( this.mbox );
this.innerBox.style.maxHeight = ( resultH < maxResultH ? resultH : maxResultH ) + "px";
bBox.style.marginTop = "-1em";
} }
}.bind( this ) }.bind( this )