Created
May 14, 2017 03:57
-
-
Save kgtkr/84b91ab5ccf717606e3a7e78e77ab4a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body{ | |
font-size:var(--font-size,16px); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setFontSize(size){ | |
localStorage.setItem('font-size',size); | |
document.body.style.setProperty(size); | |
} | |
$(()=>{ | |
let size=localStorage.getItem('font-size'); | |
if(size){ | |
setFontSize(size); | |
} | |
}); | |
$('#font-min').on('click',()=>setFontSize('12px')); | |
$('#font-normal').on('click',()=>setFontSize('16px')); | |
$('#font-big').on('click',()=>setFontSize('20px')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment