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

5
src/definitions/modules/sidebar.less

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

Loading…
Cancel
Save