Summary Files Commits Branches @commit @diff @stats
path: root / src / scripts / page-width.js
diff options
context:
space:
mode:
1 files changed, 4 insertions, 3 deletions
-rw-r--r--src/scripts/page-width.js7
diff --git a/src/scripts/page-width.js b/src/scripts/page-width.js
index c77912c..9b632df 100644
--- a/src/scripts/page-width.js
+++ b/src/scripts/page-width.js
@@ -1,8 +1,9 @@
const widthBtn = document.getElementById('changeWidthBtn');
+const widthLabel = widthBtn.childNodes[0];
const articleElem = document.getElementsByTagName('article')[0];
if (localStorage.getItem('width') === 'wide') {
- widthBtn.innerText = 'Narrow\narticle';
+ widthLabel.innerText = 'Narrow';
articleElem.classList.add('noMaxWidth');
}
@@ -10,11 +11,11 @@ widthBtn.onclick = function() {
articleElem.classList.toggle('noMaxWidth');
if (localStorage.getItem('width') !== 'norm') {
- widthBtn.innerText = 'Wide\narticle';
+ widthLabel.innerText = 'Wide';
localStorage.setItem('width', 'norm');
}
else {
- widthBtn.innerText = 'Narrow\narticle';
+ widthLabel.innerText = 'Narrow';
localStorage.setItem('width', 'wide');
}
}