image gallery next prev (php array in javascript array) -
i trying create function change picture if push on image "prev" oder "next". have no idea how realize that, because source of picture database.
$namen = array(); $mainimg = array(); $sql1 = mysql_query("select * image id = ".$id.";"); echo "<div class='normal'>"; while($row = mysql_fetch_array($sql1)) { $namen[] = $row['bild']; $mainimg[] = $row['mainimg']; $number_array = count($namen); ?> <script type='text/javascript'> <?php $php_array = array($row['bild']); $js_array = json_encode($php_array); echo "var javascript_array = ". $js_array . ";\n"; ?> </script> <?php if($row['mainimg'] == 1){ $bild = $row['bild']; } } echo "<div class='rahmen'><div class='box'><a href='#' id='opn'><img style='position:absolute;margin:90px 0px 0px 130px;' src='images/lupe.png'>".$path.$bild."\"".$end."</a></div> <div class='hover1 box1'></div><div onclick='prev()' class='hover2 box2'></div></div>"; echo "<a href='' onclick=\"\"><div id='next'></div></a>"; echo "<a href='' onclick=\"\"><div id='prev'></div></a>"; .rahmen {position:relative;cursor:pointer;} .box1 { height:64px;width:53px;} .box2 { height:64px;width:53px;margin-left:347px;} .hover1 { background:url(images/prev1.png) no-repeat; } .hover1:hover { background:url(images/prev.png) no-repeat; } .hover1 { display:none;position:absolute;top:40%;} div.rahmen:hover .hover1{ display:block;} .hover2 { background:url(images/next1.png) no-repeat; } .hover2:hover { background:url(images/next.png) no-repeat;} .hover2 { display:none;position:absolute;top:40%; } div.rahmen:hover .hover2{ display:block;} now have php-array in javascript array. :-) have 2 problems: - click on image "prev" , "next" doesn't work , don't know why. secondly have no idea how programm function change image if push next or prev. can me please?
thanks in advance.
regards, yanick
if need know how convert php array js array, take @ this answer. , if don't know how implement gallery, please give little bit more information, like: use gallery libraries? libraries use? etc...
Comments
Post a Comment