// 이미지 클릭시 원본 크기로 팝업 보기 function doImgPop(img){ img1= new Image(); img1.src=(img); imgControll(img); } function imgControll(img){ if((img1.width!=0)&&(img1.height!=0)){ viewImage(img); } else{ controller="imgControll('"+img+"')"; intervalID=setTimeout(controller,20); } }
function viewImage(img){ W=img1.width; H=img1.height; O="width="+W+",height="+H+",scrollbars=yes"; imgWin=window.open("","",O); imgWin.document.write("<html><head><title>:*:*:*: 이미지상세보기 :*:*:*:*:*:*:</title></head>"); imgWin.document.write("<body topmargin=0 leftmargin=0>"); imgWin.document.write("<img src="+img+" onclick='self.close()' style='cursor:pointer;' title ='클릭하시면 창이 닫힙니다.'>"); imgWin.document.close(); }
<!-- 사용시 -->
<img src="파일경로" width="295px" height="295px" title="클릭하시면 원본크기로 보실 수 있습니다." style="cursor: pointer;" onclick="doImgPop('파일경로')" " />
원본크기로 팝업창 띄운 후 클릭시 이미지팝업창 닫힘
[출처] 이미지 클릭시 원본 크기로 팝업 보기|작성자 대을이