Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(docs): fix animation for menu-toggle
Browse files Browse the repository at this point in the history
References #6572 Fixes #6262 Fixes #6936

  Closes #6937
  • Loading branch information
devversion authored and ThomasBurleson committed Feb 1, 2016
1 parent e164e69 commit c739d11
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions docs/app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ function(SERVICES, COMPONENTS, DEMOS, PAGES, $location, $rootScope, $http, $wind
};
})

.directive('menuToggle', [ '$timeout', function($timeout) {
.directive('menuToggle', [ '$timeout', '$mdUtil', function($timeout, $mdUtil) {
return {
scope: {
section: '='
Expand All @@ -479,20 +479,21 @@ function(SERVICES, COMPONENTS, DEMOS, PAGES, $location, $rootScope, $http, $wind
$scope.toggle = function() {
controller.toggleOpen($scope.section);
};
$scope.$watch(

$mdUtil.nextTick(function() {
$scope.$watch(
function () {
return controller.isOpen($scope.section);
},
function (open) {
var $ul = $element.find('ul');

$timeout(function updateHeight() {
$timeout(function () {
$ul.css({ height: (open ? getTargetHeight() : 0) + 'px' });
}, 0, false);
var targetHeight = open ? getTargetHeight() : 0;
$timeout(function () {
$ul.css({height: targetHeight + 'px'});
}, 0, false);

function getTargetHeight () {
function getTargetHeight() {
var targetHeight;
$ul.addClass('no-transition');
$ul.css('height', '');
Expand All @@ -502,8 +503,8 @@ function(SERVICES, COMPONENTS, DEMOS, PAGES, $location, $rootScope, $http, $wind
return targetHeight;
}
}
);

);
});

var parentNode = $element[0].parentNode.parentNode.parentNode;
if(parentNode.classList.contains('parent-list-item')) {
Expand Down

0 comments on commit c739d11

Please sign in to comment.