From e08e326a6777e70934270015935ac7dccf26e72b Mon Sep 17 00:00:00 2001 From: Snuffleupagus Date: Sat, 26 Jan 2013 22:17:37 +0100 Subject: [PATCH] Automatically resize the zoom box width to fit the content --- web/viewer.css | 1 - web/viewer.js | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/web/viewer.css b/web/viewer.css index c73581062..0a034e2a7 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -665,7 +665,6 @@ html[dir='rtl'] .dropdownToolbarButton { } .dropdownToolbarButton { - min-width: 120px; max-width: 120px; padding: 3px 2px 2px; overflow: hidden; diff --git a/web/viewer.js b/web/viewer.js index 29ff1298a..a666fff4a 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -3080,6 +3080,16 @@ function selectScaleOption(value) { window.addEventListener('localized', function localized(evt) { document.getElementsByTagName('html')[0].dir = mozL10n.getDirection(); + + // Adjust the width of the zoom box to fit the content. + var container = document.getElementById('scaleSelectContainer'); + var select = document.getElementById('scaleSelect'); + + select.setAttribute('style', 'min-width: inherit;'); + var width = select.clientWidth + 8; + container.setAttribute('style', 'min-width: ' + width + 'px; ' + + 'max-width: ' + width + 'px;'); + select.setAttribute('style', 'min-width: ' + (width + 20) + 'px;'); }, true); window.addEventListener('scalechange', function scalechange(evt) {