CSS:
HTML:
JAVSCRIPT:
div.album-files { width: 100%; height: 50px; float: left; font-family: 'Oswald', sans-serif; } div.album-files div.drag-drop { float: left; height: 100%; width: 100%; text-align: center; position: relative; display: table; overflow: hidden; background-color: #429FD8; } div.album-files div.drag-drop:hover, div.album-files div.drag-drop:hover:active { background-color: #1C70B7; } div.album-files div.drag-drop input[type=file] { height: 100%; width: 100%; position: absolute; cursor: pointer; opacity: 0; top: 0; left: 0; z-index: 1; } div.album-files div.drag-drop span { position: relative; display: table-cell; vertical-align: middle; color: #fff; text-align: center; font-size: 18px; line-height: 25px; font-weight: normal; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
HTML:
<div class="album-files"> <div class="drag-drop"> <input type="file" accept="image/*"> <span>Seleccionar foto</span> </div> </div>
JAVSCRIPT:
$('.album-files .drag-drop input[type=file]').change(function() { $(this).next('span').html($(this).prop('files')[0].name); });
Comentarios
Publicar un comentario