Skip to content

Commit

Permalink
stop moving the margin-left of the container when a drawer is opened …
Browse files Browse the repository at this point in the history
…to prevent jumpyness
  • Loading branch information
jasoncalabrese committed Mar 18, 2015
1 parent c2a1141 commit fd47ec9
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions static/js/ui-utils.js
Expand Up @@ -155,39 +155,29 @@ function toggleDrawer(id, openCallback, closeCallback) {
function openDrawer(id, callback) {
function closeOpenDraw(callback) {
if (openDraw) {
fastClose(openDraw, callback);
closeDrawer(openDraw, callback);
} else {
callback(true)
callback()
}
}

closeOpenDraw(function (container) {
closeOpenDraw(function () {
openDraw = id;
if (container) {
$('#container').animate({marginLeft: '-300px'}, 300);
$('#chartContainer').animate({marginLeft: '-300px'}, 300);
}
$(id).css('display', 'block').animate({right: '0'}, 300, function () {
if (callback) callback();
});
});

}

function fastClose(id, callback) {
function closeDrawer(id, callback) {
openDraw = null;
$(id).animate({right: '-300px'}, 300, function () {
$(id).css('display', 'none');
if (callback) callback();
});
}

function closeDrawer(id, callback) {
openDraw = null;
$('#container').animate({marginLeft: '0px'}, 300, callback);
$('#chartContainer').animate({marginLeft: '0px'}, 300);
fastClose(id, callback);
}

if (openDraw == id) {
closeDrawer(id, closeCallback);
} else {
Expand Down Expand Up @@ -400,13 +390,13 @@ $(function() {
fade: true,
gravity: 'n',
opacity: 0.75
}
};

if (querystring.notify) {
showNotification(querystring.notify, querystring.notifytype);
}

if (querystring.drawer) {
openDrawer();
openDrawer('#drawer');
}
});

0 comments on commit fd47ec9

Please sign in to comment.