Created
March 7, 2017 20:24
-
-
Save paulfarino/7d9467e3edac2fbaf77f7fc350a3765f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <button onclick="increaseContrast()">Increase Contrast</button> |
This file contains hidden or 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
| // Check local storage to see if the key 'contrast_increase' has been set to 'true' | |
| window.onload = function() { | |
| if (localStorage.getItem('contrast_increase') === 'true') { | |
| increaseContrast() | |
| } else { | |
| console.log('Do Nothing') | |
| } | |
| }; | |
| // Set contrast hex code in local storage | |
| function increaseContrast() { | |
| document.getElementById('body').style.backgroundColor = "#DDDDDD"; | |
| localStorage.setItem('contrast_increase', 'true'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment