Skip to content

Instantly share code, notes, and snippets.

@jessgusclark
Last active January 26, 2017 17:12
Show Gist options
  • Save jessgusclark/1de992a6af147cc71d86e3cafb41a26d to your computer and use it in GitHub Desktop.
Save jessgusclark/1de992a6af147cc71d86e3cafb41a26d to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>FlexSlider Demo</title>
<link rel="stylesheet" href="http://flexslider.woothemes.com/css/flexslider.css" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://flexslider.woothemes.com/js/jquery.flexslider.js"></script>
</head>
<body>
<!-- Place somewhere in the <body> of your page -->
<div class="flexslider">
<ul class="slides">
<li> <img src="http://lorempixel.com/400/200/sports/" />
<p class="flex-caption">Slide 1</p>
</li>
<li> <img src="http://lorempixel.com/400/200/people/" />
<p class="flex-caption">Slide 2</p>
</li>
<li> <img src="http://lorempixel.com/400/200/abstract/" />
<p class="flex-caption">Slide 3</p>
</li>
</ul>
</div>
<script type="text/javascript" charset="utf-8">
$(window).load(function() {
// get the total number of slides:
var numberOfSlides = $(".slides li").size();
// select a random number between 0 and numberOfSlides.
var randomStart = Math.floor( Math.random() * numberOfSlides );
$('.flexslider').flexslider({
startAt: randomStart
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment