mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
docs(demos): add scrollbar check helper function
This commit is contained in:
@ -194,7 +194,6 @@ ion-card.adv-map p {
|
|||||||
.demo-list-icons icon#secondary {
|
.demo-list-icons icon#secondary {
|
||||||
color: #32DB64;
|
color: #32DB64;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.md {
|
body.md {
|
||||||
border-top: 24px solid black;
|
border-top: 24px solid black;
|
||||||
}
|
}
|
||||||
@ -224,7 +223,7 @@ body.md img#md-only {
|
|||||||
body.ios img#ios-only {
|
body.ios img#ios-only {
|
||||||
display: block !important;
|
display: block !important;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -16px;
|
top: -1rqww6px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
|
@ -64,6 +64,38 @@ export function toTitleCase(str) {
|
|||||||
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
|
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function hasScrollbar() {
|
||||||
|
console.log(window);
|
||||||
|
// The Modern solution
|
||||||
|
if (typeof window.innerWidth === 'number')
|
||||||
|
return window.innerWidth > document.documentElement.clientWidth
|
||||||
|
|
||||||
|
// rootElem for quirksmode
|
||||||
|
var rootElem = document.documentElement || document.body
|
||||||
|
|
||||||
|
// Check overflow style property on body for fauxscrollbars
|
||||||
|
var overflowStyle
|
||||||
|
|
||||||
|
if (typeof rootElem.currentStyle !== 'undefined')
|
||||||
|
overflowStyle = rootElem.currentStyle.overflow
|
||||||
|
|
||||||
|
overflowStyle = overflowStyle || window.getComputedStyle(rootElem, '').overflow
|
||||||
|
|
||||||
|
// Also need to check the Y axis overflow
|
||||||
|
var overflowYStyle
|
||||||
|
|
||||||
|
if (typeof rootElem.currentStyle !== 'undefined')
|
||||||
|
overflowYStyle = rootElem.currentStyle.overflowY
|
||||||
|
|
||||||
|
overflowYStyle = overflowYStyle || window.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'
|
||||||
|
|
||||||
|
return (contentOverflows && overflowShown) || (alwaysShowScroll)
|
||||||
|
}
|
||||||
|
|
||||||
export function getPageFor(hash) {
|
export function getPageFor(hash) {
|
||||||
return {
|
return {
|
||||||
'action-sheets': ActionSheetPage,
|
'action-sheets': ActionSheetPage,
|
||||||
|
Reference in New Issue
Block a user