I'm working on an article slider, whose articles are in a database that can be deleted / added (CMS), everything is working perfectly, the database, and the slider. Now I just wanted to integrate the articles into the slider. Here is my code, what is happening is that the articles are all appearing at the same time on top of each other, any tips?
JS:
sliderInt=1;
sliderNext=2;
$("#newsText > p#1").fadeIn(500);
startSlider();
function startSlider() {
count = $("#newsText > p").size();
loop = setInterval (function() {
if (sliderNext>count) {
sliderNext = 1;
sliderInt = 1;
}
$("#newsText > p").fadeOut(500);
$("#newsText > p#" + sliderNext).delay(500).fadeIn(500);
sliderInt = sliderNext;
sliderNext ++;
} ,7500);
}
function stopLoop() {
window.clearInterval(loop);
}
function showSlide(id) {
stopLoop();
if (id>count) {
id = 1;
}
else if (id<1) {
id=count;
}
$("#newsText > p").fadeOut(500);
$("#newsText > p#" + id).fadeIn(500);
sliderInt = id;
sliderNext = id + 1;
startSlider();
}
})
PHP:
<?php
include_once('php/CMS/includes/connection.php');
include_once('php/CMS/includes/article.php');
?>
.......HTML....
<?php
for ($id=1; $id < count($articles); $id++) {
echo ("<p id=".$id.">".$articles[$id]['article_content']."</p>");
}
?>