我有一個表格,它使用這個小腳本found here來輸出當前上傳的圖像到訪問者的瀏覽器本身。圖像的輸出太突然了。我如何使這個腳本fadein
圖像到div #blah。預覽圖像fadein
<script>
$(document).ready(function() {
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#blah').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#image-one").change(function(){
readURL(this);
});
});
</script>
這裏是html,如果有幫助。提前致謝。
<fieldset class="images">
<label for="image" class="label">UPLOAD IMAGE :</label>
<input type="file" name="image-one" id="image-one" tabindex="25" required=""/>
</fieldset>
<div class="inline-image-preivew">
<img id="blah" src="#" width="300" align="center"/>
</div>
剛上一張小紙條preivew通常拼寫預覽。 只要確保你的CSS具有相同的拼寫。 – Pogrindis
明白了,謝謝。 – gurung