Skip to content

Commit

Permalink
fix sticky header/footer resizing
Browse files Browse the repository at this point in the history
minor style update for collapsed layout
  • Loading branch information
Ben Rubin authored and Ben Rubin committed Jul 15, 2016
1 parent 98892d5 commit 7e3642e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/expansionPanels.scss
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ md-expansion-panel-header {
padding: 0 24px;
box-sizing: border-box;
border-bottom: 1px solid;
align-items: center;
}

&.md-stick {
Expand Down
9 changes: 6 additions & 3 deletions src/js/expansionPanel.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ function expansionPanelDirective() {
// listen to window scroll events
angular.element($window)
.on('scroll', debouncedUpdateScroll)
.on('resize', debouncedUpdateScroll);
.on('resize', debouncedUpdateScroll)
.on('resize', debouncedUpdateResize);
}


Expand All @@ -310,7 +311,8 @@ function expansionPanelDirective() {

angular.element($window)
.off('scroll', debouncedUpdateScroll)
.off('resize', debouncedUpdateScroll);
.off('resize', debouncedUpdateScroll)
.off('resize', debouncedUpdateResize);
}


Expand Down Expand Up @@ -349,7 +351,8 @@ function expansionPanelDirective() {
}


function updateResize(value) {
function updateResize() {
var value = $element[0].offsetWidth;
if (footerCtrl && footerCtrl.noSticky === false) { footerCtrl.onResize(value); }
if (headerCtrl && headerCtrl.noSticky === false) { headerCtrl.onResize(value); }
}
Expand Down
4 changes: 2 additions & 2 deletions src/js/expansionPanelHeader.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function expansionPanelHeaderDirective() {
if (panelbottom < 0) {
offset += panelbottom;
}

// set container width because element becomes postion fixed
container.css('width', element[0].offsetWidth + 'px');
container.css('top', offset + 'px');
Expand All @@ -82,7 +82,7 @@ function expansionPanelHeaderDirective() {

function onResize(width) {
if (isStuck === false) { return; }
element.css('width', width + 'px');
container.css('width', width + 'px');
}


Expand Down

0 comments on commit 7e3642e

Please sign in to comment.