Browse Source

#1933, more optimizations for sidebar

pull/2034/head
jlukic 9 years ago
parent
commit
243243a78a
1 changed files with 12 additions and 9 deletions
  1. 21
      src/definitions/modules/sidebar.js

21
src/definitions/modules/sidebar.js

@ -474,6 +474,7 @@ $.fn.sidebar = function(parameters) {
? $module ? $module
: $pusher, : $pusher,
animate, animate,
dim,
transitionEnd transitionEnd
; ;
callback = $.isFunction(callback) callback = $.isFunction(callback)
@ -490,11 +491,9 @@ $.fn.sidebar = function(parameters) {
module.add.bodyCSS(); module.add.bodyCSS();
module.set.animating(); module.set.animating();
module.set.visible(); module.set.visible();
if(!module.othersVisible()) {
if(settings.dimPage) {
$pusher.addClass(className.dimmed);
}
}
};
dim = function() {
module.set.dimmed();
}; };
transitionEnd = function(event) { transitionEnd = function(event) {
if( event.target == $transition[0] ) { if( event.target == $transition[0] ) {
@ -507,6 +506,9 @@ $.fn.sidebar = function(parameters) {
$transition.off(transitionEvent + elementNamespace); $transition.off(transitionEvent + elementNamespace);
$transition.on(transitionEvent + elementNamespace, transitionEnd); $transition.on(transitionEvent + elementNamespace, transitionEnd);
requestAnimationFrame(animate); requestAnimationFrame(animate);
if(settings.dimPage && !module.othersVisible()) {
requestAnimationFrame(dim);
}
}, },
pullPage: function(callback) { pullPage: function(callback) {
@ -635,10 +637,6 @@ $.fn.sidebar = function(parameters) {
$html.addClass(className.ios); $html.addClass(className.ios);
}, },
dimmed: function() {
$pusher.addClass(className.dimmed);
},
// container // container
pushed: function() { pushed: function() {
$context.addClass(className.pushed); $context.addClass(className.pushed);
@ -647,6 +645,11 @@ $.fn.sidebar = function(parameters) {
$context.addClass(className.pushable); $context.addClass(className.pushable);
}, },
// pusher
dimmed: function() {
$pusher.addClass(className.dimmed);
},
// sidebar // sidebar
active: function() { active: function() {
$module.addClass(className.active); $module.addClass(className.active);

Loading…
Cancel
Save