2011-12-22 4 views
0

새로운 것입니다. 내 머리가 타오른다.새 탭에서 미리보기 이미지를 엽니 다.

내 문제는 내가 웹 사이트 인 lemonx.biz를 방문하는 것입니다.

나는 네 개의 프레임에 자라 헤르메스와 퓨마의 작은 신발을 전시했다.

ZARA 퓨마와 헤르메스를 보여주는 폴더 images/zara/thumbnals/1.png에있는 작은 이미지에 사용자가 클릭 새 창 탭 HTML 자바 스크립트 또는 jQuery를 사용하여 사업부에서 images/zara/1.png 이미지에서 썸네일의 더 큰 버전을 표시 열립니다 신발

.

답변

2

큰 이미지 버전을 가리키는 hreftarget="_blank"을 사용하여 이미지를 앵커 태그로 감싸십시오.

편집 : 업데이트 된 지침에 따라.

이미지에 직접 연결하는 대신 next.html#name_of_image.jpg에 연결하십시오. 그런 다음 next.html이로드되면 javascript를 실행하여 대상 div를 적절한 이미지로 채 웁니다.

는 예 :

<!--Include a placeholder image in your HTML in the target div...--> 
<div id="target_div"> 
    <img id="target_img" style="display: none;" src=""/> 
</div> 

<!--...And populate it on page load with Javascript.--> 
<script type="text/javascript"> 
    window.onload = function() 
    { 
     if (location.hash) //Only do this if there's an actual hash value. 
     { 
      var imgPath = 'path/to/images/directory/'; //Build the path to the images directory. 
      var imgName = location.hash.substring(1); //Get the name of the image from the hash and remove the #. 
      document.getElementById('target_img').src = imgPath+imgName; //Update the src of the placeholder image with the path and name of the real one. 
      document.getElementById('target_img').style.display = 'inline'; //Now that it has a valid source, reveal it to the viewer. 
     } 
    } 
</script> 
+0

나는 그것이 작동했을하지만 난 내가 특정 사업부 – sajid

+0

에 next.html에서 클릭 썸네일을 열려는 사업부가이 페이지에 페이지 next.html이 @ sahid Ahh, ok. 땀 없습니다. 위의 수정 된 답변을 확인하십시오. – Aaron

+0

친애하는 아론 내가 무엇을 할 것입니다 나는 사진의 100s가 있고 모든 사진과 나는 HTML을 첨부해야하고 그 모든 HTML은 자바 스크립트 코드를 포함해야 내가 솔루션을 필요가 없습니다 몇 가지 동적이 필요합니다 – sajid

관련 문제