Skip to content

Instantly share code, notes, and snippets.

@kixton
Last active August 29, 2015 14:19
Show Gist options
  • Save kixton/af396dcf6e4ad70d57e2 to your computer and use it in GitHub Desktop.
Save kixton/af396dcf6e4ad70d57e2 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>Slideshow</title>
<style>
body {
font-family: 'Arial';
text-align: center;
}
h1 {
font-size: 2em;
text-transform: uppercase;
letter-spacing: 1px;
}
.container {
margin: 50px;
}
#slideshow {
width: 288px;
height: 288px;
background: url(https://d1qb2nb5cznatu.cloudfront.net/startups/i/368385-40e4f57cce037eec568c2cfe4e86fa90-medium_jpg.jpg);
background-repeat: no-repeat;
background-size: cover;
margin: auto;
}
</style>
</head>
<body>
<div class="container">
<h1>Earnest Team</h1>
<div id="slideshow"></div>
<h2 class="name"></h2>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$(document).ready(function() {
var imgBase = "https://www.meetearnest.com/images/meet-earnest/";
var pictures = [{
name: "Louis Beryl",
imgUrl: "earnest_louis.5f7fecac.jpg"
},
{
name: "Ben Hutchinson",
imgUrl: "earnest_ben.2254bc8c.jpg"
},
{
name: "Brian Romanko",
imgUrl: "earnest_brian.2ab803ac.jpg"
},
{
name: "Scott Turnquest",
imgUrl: "earnest_quest.26cb15aa.jpg"
},
{
name: "Scott Tsuchiyama",
imgUrl: "earnest_scott.25edb173.jpg"
},
{
name: "Connie Chang",
imgUrl: "earnest_connie.0ac79dee.jpg"
},
{
name: "Patrick Stanley",
imgUrl: "earnest_patrick.cd51f786.jpg"
},
{
name: "Byron Callan",
imgUrl: "earnest_byron.4b351482.jpg"
},
{
name: "Hala Baig",
imgUrl: "earnest_hala.00ab2efc.jpg"
}
];
var counter = 0;
// change background after 1.5 seconds
var changeBackground = function() {
$("#slideshow").css("background", "url(" + imgBase + pictures[counter].imgUrl + ")");
$(".name").text(pictures[counter].name);
// after fully cycling through pictures, reset counter to first image
(counter === pictures.length-1) ? counter=0 : counter+=1;
};
setInterval(function(){changeBackground()}, 1500);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment