From 243243a78a38c8ae591b639447a4c6fdfa3d930c Mon Sep 17 00:00:00 2001 From: jlukic Date: Sat, 14 Mar 2015 02:35:54 -0400 Subject: [PATCH] #1933, more optimizations for sidebar --- src/definitions/modules/sidebar.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/definitions/modules/sidebar.js b/src/definitions/modules/sidebar.js index 6073b0ec7..d00b04d55 100644 --- a/src/definitions/modules/sidebar.js +++ b/src/definitions/modules/sidebar.js @@ -474,6 +474,7 @@ $.fn.sidebar = function(parameters) { ? $module : $pusher, animate, + dim, transitionEnd ; callback = $.isFunction(callback) @@ -490,11 +491,9 @@ $.fn.sidebar = function(parameters) { module.add.bodyCSS(); module.set.animating(); module.set.visible(); - if(!module.othersVisible()) { - if(settings.dimPage) { - $pusher.addClass(className.dimmed); - } - } + }; + dim = function() { + module.set.dimmed(); }; transitionEnd = function(event) { if( event.target == $transition[0] ) { @@ -507,6 +506,9 @@ $.fn.sidebar = function(parameters) { $transition.off(transitionEvent + elementNamespace); $transition.on(transitionEvent + elementNamespace, transitionEnd); requestAnimationFrame(animate); + if(settings.dimPage && !module.othersVisible()) { + requestAnimationFrame(dim); + } }, pullPage: function(callback) { @@ -635,10 +637,6 @@ $.fn.sidebar = function(parameters) { $html.addClass(className.ios); }, - dimmed: function() { - $pusher.addClass(className.dimmed); - }, - // container pushed: function() { $context.addClass(className.pushed); @@ -647,6 +645,11 @@ $.fn.sidebar = function(parameters) { $context.addClass(className.pushable); }, + // pusher + dimmed: function() { + $pusher.addClass(className.dimmed); + }, + // sidebar active: function() { $module.addClass(className.active);