Skip to content

Instantly share code, notes, and snippets.

@nathansmith
Created March 16, 2011 19:56
Show Gist options
  • Save nathansmith/873190 to your computer and use it in GitHub Desktop.
Save nathansmith/873190 to your computer and use it in GitHub Desktop.
<!--
A quick fix for my friend Chris Bowler.
http://chrisbowler.com/journal/alternate-css-files
-->
<link rel="stylesheet" media="screen" id="time_style" href="/-/css/day.css" />
<script>
(function() {
var currentTime = new Date().getHours();
if (currentTime < 7 || currentTime > 20) {
document.getElementById('time_style').href = '/-/css/night.css';
}
})();
</script>
@nathansmith
Copy link
Author

This way, there's at least a default present, and you override it only if it's night time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment