Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CSS (just an example, duh)
- img#thumbnail {\
- display: none;\
- position: fixed;\
- right: 10px;\
- top: 35px;\
- max-width: 380px;\
- max-height: 200;\
- border-shadow: black 0 0 15px;\
- opacity: .7;\
- }\
- img#thumbnail:hover{\
- opacity: 1;\
- }\
- var img = document.createElement('img');
- img.id = 'thumbnail';
- document.body.appendChild(img);
- var finput = $('input[name="upfile"]');
- finput.addEventListener('change', function(e) {
- var f = e.target.files[0];
- //console.log('File changed, new file: '+f.name);
- if (!f) {
- $('img#thumbnail').style.display = 'none';
- return;
- }
- var r = new FileReader();
- r.onload = function(e) {
- $('img#thumbnail').src = e.target.result;
- $('img#thumbnail').style.display = 'block';
- }
- r.readAsDataURL(f);
- }, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement