Created
August 22, 2015 07:51
-
-
Save curtiswilkinson/6d1affc22422a7b19f2d to your computer and use it in GitHub Desktop.
Hiding DOM element base on day of the week/hour of day
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
$(document).ready(function () { | |
var d = new Date(); | |
var dayOfWeek = d.getDay() | |
var hour = d.getHours(); | |
if (dayOfWeek === 1 || dayOfWeek === 2 || dayOfWeek === 3) { | |
$('.element').show(); | |
} | |
if (dayOfWeek === 4 && hour < 13) { | |
$('.element').show(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment