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

Commit c739d11

Browse files
devversionThomasBurleson
authored andcommitted
fix(docs): fix animation for menu-toggle
References #6572 Fixes #6262 Fixes #6936 Closes #6937
1 parent e164e69 commit c739d11

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

docs/app/js/app.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ function(SERVICES, COMPONENTS, DEMOS, PAGES, $location, $rootScope, $http, $wind
464464
};
465465
})
466466

467-
.directive('menuToggle', [ '$timeout', function($timeout) {
467+
.directive('menuToggle', [ '$timeout', '$mdUtil', function($timeout, $mdUtil) {
468468
return {
469469
scope: {
470470
section: '='
@@ -479,20 +479,21 @@ function(SERVICES, COMPONENTS, DEMOS, PAGES, $location, $rootScope, $http, $wind
479479
$scope.toggle = function() {
480480
controller.toggleOpen($scope.section);
481481
};
482-
$scope.$watch(
482+
483+
$mdUtil.nextTick(function() {
484+
$scope.$watch(
483485
function () {
484486
return controller.isOpen($scope.section);
485487
},
486488
function (open) {
487489
var $ul = $element.find('ul');
488490

489-
$timeout(function updateHeight() {
490-
$timeout(function () {
491-
$ul.css({ height: (open ? getTargetHeight() : 0) + 'px' });
492-
}, 0, false);
491+
var targetHeight = open ? getTargetHeight() : 0;
492+
$timeout(function () {
493+
$ul.css({height: targetHeight + 'px'});
493494
}, 0, false);
494495

495-
function getTargetHeight () {
496+
function getTargetHeight() {
496497
var targetHeight;
497498
$ul.addClass('no-transition');
498499
$ul.css('height', '');
@@ -502,8 +503,8 @@ function(SERVICES, COMPONENTS, DEMOS, PAGES, $location, $rootScope, $http, $wind
502503
return targetHeight;
503504
}
504505
}
505-
);
506-
506+
);
507+
});
507508

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

0 commit comments

Comments
 (0)