Last active
December 27, 2015 07:09
-
-
Save martynchamberlin/7287246 to your computer and use it in GitHub Desktop.
This is the most drop-dead simple jQuery slideshow you could possibly have. Nothing fancy at all, but mind-boggling get-out-of-the-way simple. Actually using it for a client project.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="slider"> | |
<img> | |
<input type="hidden" value="/wp-content/themes/geek/images/slide1.png"> | |
<input type="hidden" value="/wp-content/themes/geek/images/slide2.png"> | |
<input type="hidden" value="/wp-content/themes/geek/images/slide3.png"> | |
<input type="hidden" value="/wp-content/themes/geek/images/slide4.png"> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function( $ ) | |
{ | |
var i = 0; | |
var url = $('#slider input'); | |
function slide() | |
{ | |
$('#slider img').attr('src', $(url[i]).val() ); | |
i >= $('#slider input').length - 1 ? i = 0 : i++; | |
} | |
setInterval(slide, 7000); | |
slide(); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment