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

Commit

Permalink
fix(select): improve disable scroll layout
Browse files Browse the repository at this point in the history
closes #2307, closes #2330
  • Loading branch information
rschmukler committed Apr 16, 2015
1 parent 6d4ecbe commit 68395a2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/components/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,11 @@ function SelectProvider($$interimElementProvider) {
});

opts.resizeFn = function() {
animateSelect(scope, element, opts);
$$rAF(function() {
$$rAF(function() {
animateSelect(scope, element, opts);
});
});
};

angular.element($window).on('resize', opts.resizeFn);
Expand Down
14 changes: 13 additions & 1 deletion src/core/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,26 @@ angular.module('material.core')
wrapperEl.css({
overflow: 'hidden',
position: 'fixed',
width: '100%',
display: computedStyle.display,
'padding-top': computedStyle.paddingTop,
top: (-1 * heightOffset) + 'px'
});


computeSize();

angular.element($window).on('resize', computeSize);

function computeSize() {
wrapperEl.css({
'max-width': disableTarget[0].offsetWidth
});
}

return function restoreScroll() {
disableTarget.append(wrapperEl.children());
wrapperEl.remove();
angular.element($window).off('resize', computeSize);
if (scrollBarsShowing) {
disableTarget.css('overflow-y', restoreOverflowY || false);
}
Expand Down

0 comments on commit 68395a2

Please sign in to comment.