Image swap is Driving me crazy...
Hey guys,
hopefully someone here can help me out. essentially what i'm trying to do is a timed image swap. Simple right? Wrong (in my case).
I have tried several plug-ins, and several non jquery solutions, and none of them will do what i need to. I will be honest im not very good with the whole JS scene yet, so most of what i know is very basic.
what i want to do is replace an image with a random one from a directory, but i want to do it like 7 times on the page because its going to be for a navigation system, and the image is coming from a list. It is one picture now, and is using the instant plugin.
the code for this list is as follows.
-
<?php
if(!isset($pageloc)){$pageloc ='';}
if (!isset($_GET['p'])){$p=1;}else{$p=$_GET['p'];}
if(isset($_GET['p'])){$page=$_GET['p'];}else{$page='1';}
$query = "SELECT * FROM categories ORDER BY id";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)){
if($page==$row['id']){$on=' id="on"';$full='on';}else{$on='';}
if( is_odd($row['id'])){$class=' class="instant itxtalt'.$full.' '.$row['catname'].'"';} else{$class=' class="instant itxtalt'.$full.' '.$row['catname'].'"';}
echo "<li".$on."><a href=\"index.php?p=".$row['id']."\"><img id=\"rotate\"".$class."src=\"../Images/crabb.gif\" width=\"125px\" height=\"115px\" alt=\"".$row['catname']."\" /></a></li>\n";
}
?>
so what ends up happening is that the script replaces the current image with the exact same image across the board.
what i had envisioned, was pulling up a php array of all the img's in the directory, and then caching them. then have the JS replace the default image and then change every few minutes.
If any one could help it would be greatly appreciated, i have spent the greater part of the week trying to figure this out.