I want to make a slideshow on my site, but the problem is that the setInterval works only one time. It loads my file only one time end then stops.
Heres the code:
main.html
<img src="images/ex/full.jpg" width="800" height="377" alt="">
<script>
$(document).ready(function(){
var refreshId = setInterval(function(){
$('#center').load('images/gallery/best/rotate.php');
}, 5000);
});
</script>
rotate.php
<img src="images/gallery/best/random.php?".<?php echo rand(0,1000) ?>."" width="800" height="377" alt="">
random.php contains a code which loads random image from selected folder, it works good.
Forgot to mention, I got lightbox scripts included too. Maybe they don't work together?
Head:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="vendors/jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="vendors/js/prototype.js"></script>
<script type="text/javascript" src="vendors/js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="vendors/js/lightbox.js"></script>
<link rel="stylesheet" href="styles/style.css" type="text/css" />
<link rel="stylesheet" href="styles/lightbox.css" type="text/css" />
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…