Reputation: 629
I have no errors that I can see on my console, yet my loop doesn't seem to be inserting anything into my div. You'll see the prepend in the first FOR loop.
http://jordan.rave5.com/tmpstuff/
jQuery
// Start Slides
$.get('http://jordan.rave5.com/tmpstuff/slides.txt', function (data) {
var lineArray = data.split('\n'),
slideList = [],
count = lineArray.length;
for (i = 0; i < count; i++) {
var line = lineArray[i].split('{|}');
slideList[i] = [],
slideList[i]['id'] = line[0],
slideList[i]['url'] = line[1];
$('#header-image-border').prepend('<img id="' + line[0] + '" class="header-image-size" src="' + line[1] + '" alt="The Tiger Spot" />');
}
});
$('#hi1').fadeTo(2000, 1.0, function () {
var slide = 0,
slideShow = setInterval(function () {
var nextSlide = slide + 1;
if (nextSlide > count - 1) {
nextSlide = 0;
}
$(slideList[slide]['id']).fadeTo(600, 0);
$(slideList[nextSlide]['id']).fadeTo(2300, 1.0);
slide++;
if (slide > count - 1) {
slide = 0;
}
}, 20000);
// End Slides
slides.txt
#hi1{|}slides/head1.jpg
#hi2{|}slides/head2.jpg
#hi3{|}slides/head3.jpg
#hi4{|}slides/head4.jpg
#hi5{|}slides/head5.jpg
Upvotes: 0
Views: 145
Reputation: 2005
The prepend()
works, all your images have opacity:0
set on them which is why they don't appear on the page.
Upvotes: 0
Reputation: 1150
You need to create a new div for each prepend. Create a template for your div that you can clone each cycle.
jQuery .append() called from within for loop. (Closure Issue?)
Upvotes: 1