Skip to content

Instantly share code, notes, and snippets.

@noeltock
Created October 7, 2011 20:18
Show Gist options
  • Select an option

  • Save noeltock/1271263 to your computer and use it in GitHub Desktop.

Select an option

Save noeltock/1271263 to your computer and use it in GitHub Desktop.
Nivo Random Starting Slide
You'll find this in header.php:
<!-- / Nivo Slider -->
<script type="text/javascript">
jQuery(window).load(function() {
jQuery('#slider').nivoSlider({
effect:'fade',
pauseTime:'3000',
boxCols: 8, // For box animations
boxRows: 3, // For box animations
controlNav:false,
directionNav:false,
captionOpacity:0.8
});
});
</script>
<!-- / Nivo Slider -->
Change it to this:
<!-- / Nivo Slider -->
<script type="text/javascript">
jQuery(window).load(function() {
var total = $('#slider img').length;
var rand = Math.floor(Math.random()*total);
jQuery('#slider').nivoSlider({
startSlide:rand
effect:'fade',
pauseTime:'3000',
boxCols: 8, // For box animations
boxRows: 3, // For box animations
controlNav:false,
directionNav:false,
captionOpacity:0.8
});
});
</script>
<!-- / Nivo Slider -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment