Click to make body text larger | JavaScript
- by Wayne
Please note this is just an example:
<img src="img/normal-font.png" onclick="javascript:document.body.style.fontSize = '13px';" />
<img src="img/medium-font.png" onclick="javascript:document.body.style.fontSize = '14px';" />
<img src="img/large-font.png"onclick="javascript:document.body.style.fontSize = '15px';" />
The body text does indeed enlarge if I choose one of them, but what I like to include is remembering what option you've chosen by reading cookies.
In fact, I have no experience in creating cookies in JS, only in PHP. Could someone come up with an example of how to make cookies the simpliest way remembering my option, but whenever someone clicks another one, it should get rid of the cookie that was last set, e.g. Cookie value has 15px, then should update it or remove it with a new cookie with a new value of 13px and so on.
Thanks :)