Skip to content

Instantly share code, notes, and snippets.

@wvuwebgist
Last active September 28, 2015 19:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wvuwebgist/1487615 to your computer and use it in GitHub Desktop.
Save wvuwebgist/1487615 to your computer and use it in GitHub Desktop.
FlexSlider for West Virginia University (The old skool way)
<!-- Stylesheet for flexslider -->
<link rel="stylesheet" href="/themes/shared/flexslider/stylesheets/flexslider.2.1.css" /> <!-- being sure to reference the shared folder, you may copy and paste these into your stylesheets to tweak -->
<!--======================================================
Markup for Flexslider, .flexslider and .slides are required classes:
==========================================================-->
<div class="flexslider">
<ul class="slides">
</ul> <!-- close slides -->
</div> <!-- close flexslider -->
<!-- FlexSlider scripts -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/themes/shared/javascripts/jquery-1.10.2.min.js"><\/script>')</script>
<script src="/themes/shared/flexslider/js/jquery.flexslider.2.1.min.js"></script> <!-- being sure to reference the shared folder -->
<!-- Hook up the FlexSlider for slate -->
<script>
$(document).ready(function() {
$.ajax({
type: "GET",
url: "/r/collections/2571.xml", // edit 2571.xml to match the id of your set in slate
dataType: "xml",
success: function (xml) {
$(xml).find('img').each(function(){
var caption;
if ($(this).attr("caption")) {
caption = '<p class="flex-caption">'+$("<p/>").html($(this).attr("caption")).text()+'</p>';
} else { caption = ''; }
$(".slides").append('<li><img src="'+$(this).attr("orig")+'" alt="'+$(this).attr("caption")+'" />'+caption+'</li>');
});
$('.flexslider').flexslider({animation:"fade", randomize:"true"}); // add more cool options: http://flex.madebymufffin.com/
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment