Created
January 5, 2014 23:12
-
-
Save mariokostelac/8275369 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $lessonWrapper = $('.course-wrap .lesson-wrapper'); | |
// prevent default animation of right part | |
$lessonWrapper.css('webkitTransform', 'translateX(0px)'); | |
// allow smooth resizing (just filling with default css value for attribute 'position') | |
$lessonWrapper.css('position', 'static'); | |
// allow padding animation | |
$lessonWrapper.css('webkitTransition', 'padding 0.3s'); | |
// force scrollbar to disable animation tilting | |
$('.course-inner').css('overflowY', 'scroll'); | |
var $toggleButton = $('.toggle-sidebar'), | |
$courseWrap = $('.course-wrap'), | |
toggleButtonLeft = parseInt($toggleButton.css('left')); | |
// allow toggle position animation | |
$toggleButton.css('webkitTransition', 'left 0.3s'); | |
$toggleButton.on('click', function(ev) { | |
var enabled = $courseWrap.hasClass('with-menu'), | |
offset = enabled === true ? 0 : 240; | |
$lessonWrapper.css('paddingLeft', offset + 'px'); | |
$toggleButton.css('left', toggleButtonLeft + offset + 'px'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment