diff --git a/demos/component-docs/app.css b/demos/component-docs/app.css index e7f152adb7..c3abb52814 100644 --- a/demos/component-docs/app.css +++ b/demos/component-docs/app.css @@ -1,6 +1,9 @@ body, body:hover, body a, body button, body media-switch { cursor: url('http://ionicframework.com/img/finger.png'), auto; - overflow: hidden; +} + +body.has-scrollbar scroll-content { + margin-right: -15px; } section.hidden { @@ -71,7 +74,6 @@ ion-scroll { scroll-content { overflow-y: scroll; - margin-right: -15px; } .md .ion-md-share { @@ -199,7 +201,7 @@ body.md { } body.ios{ - border-top: 20px solid #F8F8F8; + border-top: 10px solid #F8F8F8; } body.ios backdrop { @@ -223,7 +225,7 @@ body.md img#md-only { body.ios img#ios-only { display: block !important; position: absolute; - top: -1rqww6px; + top: -6px; width: 100%; height: auto; z-index: 9999; diff --git a/demos/component-docs/helpers.ts b/demos/component-docs/helpers.ts index 8c540847aa..b42e09866e 100644 --- a/demos/component-docs/helpers.ts +++ b/demos/component-docs/helpers.ts @@ -65,33 +65,35 @@ export function toTitleCase(str) { } export function hasScrollbar() { - console.log(window); - // The Modern solution - if (typeof window.innerWidth === 'number') - return window.innerWidth > document.documentElement.clientWidth + + if (typeof window.top.innerWidth === 'number') { + return window.top.innerWidth > window.top.document.documentElement.clientWidth; + } // rootElem for quirksmode - var rootElem = document.documentElement || document.body + var rootElem = window.top.document.documentElement || window.top.document.body; // Check overflow style property on body for fauxscrollbars - var overflowStyle + var overflowStyle; - if (typeof rootElem.currentStyle !== 'undefined') - overflowStyle = rootElem.currentStyle.overflow + if (typeof rootElem.currentStyle !== 'undefined') { + overflowStyle = rootElem.currentStyle.overflow; + } - overflowStyle = overflowStyle || window.getComputedStyle(rootElem, '').overflow + overflowStyle = overflowStyle || window.top.getComputedStyle(rootElem, '').overflow; - // Also need to check the Y axis overflow - var overflowYStyle + // Also need to check the Y axis overflow + var overflowYStyle; - if (typeof rootElem.currentStyle !== 'undefined') - overflowYStyle = rootElem.currentStyle.overflowY + if (typeof rootElem.currentStyle !== 'undefined') { + overflowYStyle = rootElem.currentStyle.overflowY; + } - overflowYStyle = overflowYStyle || window.getComputedStyle(rootElem, '').overflowY + overflowYStyle = overflowYStyle || window.top.getComputedStyle(rootElem, '').overflowY; - var contentOverflows = rootElem.scrollHeight > rootElem.clientHeight - var overflowShown = /^(visible|auto)$/.test(overflowStyle) || /^(visible|auto)$/.test(overflowYStyle) - var alwaysShowScroll = overflowStyle === 'scroll' || overflowYStyle === 'scroll' + var contentOverflows = rootElem.scrollHeight > rootElem.clientHeight; + var overflowShown = /^(visible|auto)$/.test(overflowStyle) || /^(visible|auto)$/.test(overflowYStyle); + var alwaysShowScroll = overflowStyle === 'scroll' || overflowYStyle === 'scroll'; return (contentOverflows && overflowShown) || (alwaysShowScroll) } diff --git a/demos/component-docs/index.ts b/demos/component-docs/index.ts index 739e78193a..2c88b1a67e 100644 --- a/demos/component-docs/index.ts +++ b/demos/component-docs/index.ts @@ -40,6 +40,12 @@ class DemoApp { }); }); window.parent.postMessage(this.platform.is('ios')? "ios":"android", "*"); + if (helpers.hasScrollbar() === true) { + setTimeout(function() { + var body = document.getElementsByTagName('body')[0]; + body.className = body.className + ' has-scrollbar'; + }, 500); + } }); } diff --git a/demos/component-docs/modals/modals.html b/demos/component-docs/modals/modals.html index 2247681de9..71345dbb0d 100644 --- a/demos/component-docs/modals/modals.html +++ b/demos/component-docs/modals/modals.html @@ -1,5 +1,5 @@ - + Modals