Skip to content

Commit

Permalink
fix(sidenav): animate the sidenav on scrolled parent too.
Browse files Browse the repository at this point in the history
  • Loading branch information
devversion committed Nov 26, 2015
1 parent 55cc93f commit 0f18d3a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/backdrop/backdrop.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ md-backdrop {

position: absolute;
top:0;
bottom:0;
left: 0;
right: 0;

height: 100%;

z-index: $z-index-backdrop;

&.md-menu-backdrop {
Expand Down
5 changes: 5 additions & 0 deletions src/components/sidenav/sidenav.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ function SidenavDirective($mdMedia, $mdUtil, $mdConstant, $mdTheming, $animate,
parent[isOpen ? 'on' : 'off']('keydown', onKeyDown);
backdrop[isOpen ? 'on' : 'off']('click', close);

// Align the sidenav at the current scroll position
var topAttribute = parent[0].scrollTop + "px";
element.css("top", topAttribute);
backdrop.css("top", topAttribute);

if ( isOpen ) {
// Capture upon opening..
triggeringElement = $document[0].activeElement;
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidenav/sidenav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ md-sidenav {

width: $sidenav-mobile-width;
max-width: $sidenav-mobile-width;
bottom: 0;
height: 100%;
overflow: auto;

ul {
Expand Down

0 comments on commit 0f18d3a

Please sign in to comment.