Simplest Ajax Photo Gallery -
i don't think "simplest" subjective.
looking hostable photo gallery nothing show image , provide "next image" , "previous image" without reloading page. precaching nice too. php, python, ruby, or js.
if want simple, maybe this?
<html> <body> <div> <img id="image"> </img> </div> <table> <tr> <td onclick="getimage("previous");">previous</td> <td onclick="getimage("next");">next</td> </tr> </table> <script type="text/javascript"> counter = 0; nextimage = new image(); previousimage = new image(); getimage = function(what) { if (what === "previous") {counter--;} else {counter++;} nextimage.src = "http://www.example.com/image?data=" + (counter + 1); previousimage.src = "http://www.example.com/image?data=" + (counter - 1); document.getelementbyid("image").src = "http://www.example.com/image?data=" + counter; } </script> </body> </html>
Comments
Post a Comment