I have a "section" element with a background image included.
<section id="header" class="color-light text-center" data-type="background" data-speed="10">
This is the CSS styling for the header section:
#header {
background: url('sunrise.jpg') 50% 0 no-repeat fixed;
height: 800px;
margin: 0;
overflow: hidden;
color: #f4f4f4;
}
Using JavaScript to determine the time of day...
var d = new Date();
var n = d.getHours();
if (n > 19 || n < 6)
$("#header").className = "night";
else if (n > 16 && n < 19)
$("#header").className = "sunset";
else
$("#header").className = "day";
The CSS file contains classes for different times of the day, but unsure on implementation:
/* backgrounds */
.day { background: url('sunrise.jpg') 50% 0 no-repeat fixed; }
.sunset { background: url('sunset.jpg') 50% 0 no-repeat fixed; }
.night { background: url('night.jpg') 50% 0 no-repeat fixed; }
Uncertain about properly changing the #header using jQuery to update the background dynamically.