sliderfader that cycles all images in folder?
Trying to adapt a simple slider/fader so that is cycles through all images in a folder.
Using this...
<script type="text/javascript">
$(function() {
var imgs = [
'../images/1.jpg',
'../images/2.jpg',
'../images/3.jpg',
'../images/4.jpg'];
var cnt = imgs.length;
var $imageSlide = $('img[id$=imageSlide]');
// set the image control to the last image
$imageSlide.attr('src', imgs[cnt-1]);
setInterval(Slider, 3000);
function Slider() {
$imageSlide.fadeOut("slow", function() {
$(this).attr('src', imgs[(imgs.length++) % cnt])
.fadeIn("slow");
});
}
});
</script>
... how can I generate the array of images that are hard coded as "var imgs ="
I know how to use php and scandir to get an array or a string; but how would I get that into the jquery javascript?
TIA!