Browse Source

Solves #1985, fixes scrollTop on mobile sidebar

Adding overflow: hidden on html had known issues with getting document scroll affecting other components that relied on this value like visibility.
pull/2390/head
jlukic 9 years ago
parent
commit
c68661d913
2 changed files with 21 additions and 7 deletions
  1. 23
      src/definitions/modules/sidebar.js
  2. 5
      src/definitions/modules/sidebar.less

23
src/definitions/modules/sidebar.js

@ -131,6 +131,9 @@ $.fn.sidebar = function(parameters) {
.off(eventNamespace) .off(eventNamespace)
.removeData(moduleNamespace) .removeData(moduleNamespace)
; ;
if(module.is.ios()) {
module.remove.ios();
}
// bound by uuid // bound by uuid
$context.off(elementNamespace); $context.off(elementNamespace);
$window.off(elementNamespace); $window.off(elementNamespace);
@ -175,7 +178,7 @@ $.fn.sidebar = function(parameters) {
module.verbose('Adding clickaway events to context', $context); module.verbose('Adding clickaway events to context', $context);
if(settings.closable) { if(settings.closable) {
$context $context
.on('click' + elementNamespace, module.event.clickaway)
.on('click' + elementNamespace, module.event.clickaway)
.on('touchend' + elementNamespace, module.event.clickaway) .on('touchend' + elementNamespace, module.event.clickaway)
; ;
} }
@ -210,7 +213,7 @@ $.fn.sidebar = function(parameters) {
}, },
add: { add: {
bodyCSS: function() {
inlineCSS: function() {
var var
width = module.cache.width || $module.outerWidth(), width = module.cache.width || $module.outerWidth(),
height = module.cache.height || $module.outerHeight(), height = module.cache.height || $module.outerHeight(),
@ -491,7 +494,7 @@ $.fn.sidebar = function(parameters) {
module.repaint(); module.repaint();
animate = function() { animate = function() {
module.bind.clickaway(); module.bind.clickaway();
module.add.bodyCSS();
module.add.inlineCSS();
module.set.animating(); module.set.animating();
module.set.visible(); module.set.visible();
}; };
@ -547,7 +550,7 @@ $.fn.sidebar = function(parameters) {
$transition.off(transitionEvent + elementNamespace, transitionEnd); $transition.off(transitionEvent + elementNamespace, transitionEnd);
module.remove.animating(); module.remove.animating();
module.remove.transition(); module.remove.transition();
module.remove.bodyCSS();
module.remove.inlineCSS();
if(transition == 'scale down' || (settings.returnScroll && module.is.mobile()) ) { if(transition == 'scale down' || (settings.returnScroll && module.is.mobile()) ) {
module.scrollBack(); module.scrollBack();
} }
@ -635,7 +638,8 @@ $.fn.sidebar = function(parameters) {
}, },
set: { set: {
// html
// ios only (scroll on html not document). This prevent auto-resize canvas/scroll in ios
ios: function() { ios: function() {
$html.addClass(className.ios); $html.addClass(className.ios);
}, },
@ -677,13 +681,18 @@ $.fn.sidebar = function(parameters) {
}, },
remove: { remove: {
bodyCSS: function() {
module.debug('Removing body css styles', $style);
inlineCSS: function() {
module.debug('Removing inline css styles', $style);
if($style && $style.length > 0) { if($style && $style.length > 0) {
$style.remove(); $style.remove();
} }
}, },
// ios scroll on html not document
ios: function() {
$html.removeClass(className.ios);
},
// context // context
pushed: function() { pushed: function() {
$context.removeClass(className.pushed); $context.removeClass(className.pushed);

5
src/definitions/modules/sidebar.less

@ -249,6 +249,11 @@ html.ios {
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
} }
html.ios,
html.ios body {
height: initial !important;
}
/******************************* /*******************************
Variations Variations

Loading…
Cancel
Save