diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-25 00:09:39 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-25 00:09:39 +0000 |
commit | 1a5c6271cbbd38a51a231e6073c67f6e579ef865 (patch) | |
tree | 7c51a88be4850f3c3a23d73e8dea00f22982df48 | |
parent | 01979dea58eec2b66163ee0a647b24f0102a5bf1 (diff) | |
download | chromium_src-1a5c6271cbbd38a51a231e6073c67f6e579ef865.zip chromium_src-1a5c6271cbbd38a51a231e6073c67f6e579ef865.tar.gz chromium_src-1a5c6271cbbd38a51a231e6073c67f6e579ef865.tar.bz2 |
WebUI Prefs: Fix scrolling behavior of left nav bar.
This restores the intended behavior of the left navr bar being not scrolling vertically, but allows horizontal scrolling to move it offscreen.
BUG=72313
TEST=Scroll up/down and left/right on preferences page. Left nav bar should be fixed for vertical scrolling, but move offscreen for horizontal scrolling.
Review URL: http://codereview.chromium.org/6574044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75998 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/options/options_page.css | 6 | ||||
-rw-r--r-- | chrome/browser/resources/options/options_page.js | 16 |
2 files changed, 19 insertions, 3 deletions
diff --git a/chrome/browser/resources/options/options_page.css b/chrome/browser/resources/options/options_page.css index 78484fd..ade1abd 100644 --- a/chrome/browser/resources/options/options_page.css +++ b/chrome/browser/resources/options/options_page.css @@ -158,19 +158,19 @@ html[toolkit=views] .button-strip { -webkit-border-end: 1px solid #c6c9ce; background: -webkit-linear-gradient(rgba(234, 238, 243, 0.2), #eaeef3), -webkit-linear-gradient(left, #eaeef3, #eaeef3 97%, #d3d7db); + position: fixed; bottom: 0; + /* We set both left and right for the sake of RTL. */ left: 0; + right: 0; top: 0; width: 266px; - position: absolute; z-index: 2; } html[dir='rtl'] #navbar-container { background: -webkit-linear-gradient(rgba(234, 238, 243, 0), #EAEEF3), -webkit-linear-gradient(right, #EAEEF3, #EAEEF3 97%, #D3D7DB); - left: auto; - right: 0; } html.hide-menu #navbar-container { diff --git a/chrome/browser/resources/options/options_page.js b/chrome/browser/resources/options/options_page.js index 4c93cf2..609a76a 100644 --- a/chrome/browser/resources/options/options_page.js +++ b/chrome/browser/resources/options/options_page.js @@ -449,6 +449,8 @@ cr.define('options', function() { document.addEventListener('focus', this.manageFocusChange_.bind(this), true); + + document.addEventListener('scroll', this.handleScroll_.bind(this)); }; /** @@ -499,6 +501,20 @@ cr.define('options', function() { }; /** + * Called when the page is scrolled; moves elements that are position:fixed + * but should only behave as if they are fixed for vertical scrolling. + * @param {Event} e The scroll event. + * @private + */ + OptionsPage.handleScroll_ = function(e) { + var horizontalOffset = document.body.scrollLeft; + // position:fixed doesn't seem to work for horizontal scrolling in RTL mode, + // so only adjust in LTR mode (where scroll values will be positive). + if (horizontalOffset >= 0) + $('navbar-container').style.left = -document.body.scrollLeft + 'px'; + }; + + /** * A function to handle mouse events (mousedown or click) on the html body by * closing subpages and/or stopping event propagation. * @return {Event} a mousedown or click event. |