How would I make this code smaller? Maybe a toggle, but people were saying this was easily done in jQuery. But the problem is that I am not a fan of using jQuery for just one thing in my code.
function open() {
document.getElementById('message').style.display='block';
document.getElementById('fade').style.display='block';
}
function close() {
document.getElementById('message').style.display='none';
document.getElementById('fade').style.display='none';
}
DRY it up.
With the whitespace and proper variable names (to be passed to a minifier), this looks like:
There are some best-practices which don’t relate to the question but are worth considering if your project grows beyond this trivial situation:
Expires:http header. Then change their URLs when they actually change. This way, clients can cache them indefinitely until you change them & then the client will immediately fetch a new version.window.pubvar =