2011-04-11 2 views
0

"가장 단순한"주관적이라고 생각하지 않습니다.가장 단순한 Ajax 사진 갤러리

이미지를 표시하고 "다음 이미지"및 "이전 이미지"를 제공하지만 페이지를 다시로드하지 않고도 모두 수행 할 수있는 호스팅 가능한 사진 갤러리를 찾고 있습니다. 분명히 precaching도 좋을 것이다. PHP, 파이썬, 루비 또는 JS.

답변

1

간단한 것을 원한다면 어쩌면 이렇게할까요?

<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>