2017-11-01 1 views
0

.psd, .ai, .eps, .pdf (html)이 포함 된 파일 목록이 있습니다. 파일 이름이 인 경우 을보고 싶습니다. 그게 가능할까요?자바 스크립트 - HTML로 된 adobe 파일보기 (마우스 오버)

아래의 스 니펫은 예입니다.

.box{ 
 
    display: none; 
 
    width: 100%; 
 
} 
 

 
a:hover + .box,.box:hover{ 
 
    display: block; 
 
    position: relative; 
 
    z-index: 100; 
 
}
This live preview for <a href="http://en.wikipedia.org/">Wikipedia</a><div class="box"><iframe src="http://en.wikipedia.org/" width = "500px" height = "500px"></iframe></div> remains open on mouseover.

+0

당신은 작은 이미지를 만들고 these.I이 모든 형식을 표시하는 방법이라고 생각하지 않습니다 표시 할 수 있습니다 –

답변

0

시도

<a href="path to your file" class="preview">Link</a><div class="box"><iframe src="" width = "500px" height = "500px" style="display:none;"></iframe></div> 

JQuery와 :

$(document).ready(function(){ 
    $(document).on('mouseover','.preview',function(){ 
var path_source=$(this).attr('href'); 
$("iframe").attr("src",path_source); 
$("iframe").show(); 

}); 
$(document).on('mouseout','.preview',function(){ 

$("iframe").hide(); 

}); 

}); 
+0

작동하지 않습니다. 일단 링크를 클릭하면 다운로드됩니다. 자동으로 파일을 미리 보지 않습니다. – Sh4m

+0

iframe을 사용하여 PDF를 "렌더링"하면 모든 브라우저에서 작동하지 않습니다. 브라우저가 PDF 파일을 처리하는 방법에 따라 다릅니다. 일부 브라우저 (예 : Firefox 및 Chrome)에는 PDF가 내장되어있어 일부 구형 브라우저 (예 : 이전 버전의 IE가 파일을 대신 다운로드하려고 시도 함)에서 PDF를 표시 할 수 있습니다. –

+0

https://stackoverflow.com/questions/19654577/html-embedded-pdf-iframe 읽기 –

관련 문제