Commit d9d220fa authored by michaelpg's avatar michaelpg Committed by Commit bot

MD Settings: Responsive sub-page width

The width only needs to be set explicitly during animations, when the card
is position: fixed.

BUG=608134
R=dbeam@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2041073002
Cr-Commit-Position: refs/heads/master@{#398217}
parent 49aa1b1a
...@@ -251,6 +251,7 @@ var MainPageBehaviorImpl = { ...@@ -251,6 +251,7 @@ var MainPageBehaviorImpl = {
// Whether finished or canceled, clean up the animation. // Whether finished or canceled, clean up the animation.
section.classList.remove('expanding'); section.classList.remove('expanding');
card.style.height = ''; card.style.height = '';
card.style.width = '';
}); });
return promise; return promise;
...@@ -271,6 +272,7 @@ var MainPageBehaviorImpl = { ...@@ -271,6 +272,7 @@ var MainPageBehaviorImpl = {
var startingTop = this.parentElement.getBoundingClientRect().top; var startingTop = this.parentElement.getBoundingClientRect().top;
var cardHeightStart = card.clientHeight; var cardHeightStart = card.clientHeight;
var cardWidthStart = card.clientWidth;
section.classList.add('collapsing'); section.classList.add('collapsing');
section.classList.remove('expanding', 'expanded'); section.classList.remove('expanding', 'expanded');
...@@ -309,7 +311,13 @@ var MainPageBehaviorImpl = { ...@@ -309,7 +311,13 @@ var MainPageBehaviorImpl = {
var options = /** @type {!KeyframeEffectOptions} */({ var options = /** @type {!KeyframeEffectOptions} */({
duration: EXPAND_DURATION duration: EXPAND_DURATION
}); });
return this.animateElement('section', card, keyframes, options);
card.style.width = cardWidthStart + 'px';
var promise = this.animateElement('section', card, keyframes, options);
promise.then(function() {
card.style.width = '';
});
return promise;
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment