2016-11-08 87 views
0

form.html是否有可能上傳後顯示的fancybox圖像和之前提交

<input type="file" name="img" onchange="previewFile(this)" > 
<a href="#">Preview</a> 

它上傳後,我想表明它在fancybox在預覽的點擊。我在現有圖像上添加fancybox,但如何添加上傳圖像?

因爲我使用現有的圖片和它的作品

$("a.fancybox").fancybox(); 
+0

告訴我們你到目前爲止做了什麼隊友 –

+0

_是否有可能_答案是__Yes__, – Satpal

+0

更新......... –

回答

1

您可以使用img標籤的圖像的預覽

var previewFile = function(event) { 
 
    var output = document.getElementById('output'); 
 
    output.src = URL.createObjectURL(event.target.files[0]); 
 
    };
<input type="file" name="img" onchange="previewFile(event)" > <br> 
 
    <a class="fancybox"><img id="output" alt="Preview Image" width="300" height="300"/></a>

+0

如何在這個provew_img上應用漂亮的盒子? –

+0

我不知道它是否會工作,但你可以附上一個img標籤示例: Preview Image coriano35

+0

我更新了片段 – coriano35

相關問題