当前位置:网站首页>JS upload avatar (you can understand it after reading it, trust me)
JS upload avatar (you can understand it after reading it, trust me)
2022-07-26 03:56:00 【Mark community】
design sketch :
html:
<div class="tx ovf">
<div class="tit"> Head portrait </div>
<div class="ovf tx-img"><img src="" alt="">
<div class="upload-b"><span> Modify the head image </span><input type="file" class="upload1"></div>
</div>
</div>css:
.ovf{overflow: hidden;}
.tit { float: left; width: 50px; margin-top: 39px; font-size: 0.9vw; color: #999999; }
.tx{ margin-top:44px; }
.tx img{ width: 90px; height: 90px; border-radius:50%; margin-right:30px;border: 1px solid #fca89d; }
.tx span{ border: solid 1px #fca89d; color: #fca89d; font-size: 16px; padding: 10px; cursor: pointer; }
.upload1 { position: absolute; right:0; }
.tx img{ float: left; }
.tx input{ width: 86%; opacity: 0; }
.upload-b { float: left; margin-top:36px; position: relative; }js:
$(".upload1").change(function(){
var file=this.files[0];
readFile(file);
});
function readFile(file) {
// New reader
var reader = new FileReader();
// Choose the reading method according to the document type
switch (file.type){
case 'image/jpg':
case 'image/png':
case 'image/jpeg':
case 'image/gif':
reader.readAsDataURL(file);For more information, please refer to the original , Reproduced from :https://blog.csdn.net/weixin_44519496/article/details/120074416
边栏推荐
- Analysis on the infectious problem of open source license
- 容器跑不动?网络可不背锅
- 深度学习之DAT
- 5年1.4W倍,NFT OG 的封神之路|Web3专栏
- Dat of deep learning
- 通用测试用例写作规范
- Why are more and more users of Bing search?
- [Reading Notes - > data analysis] Introduction to BDA textbook data analysis
- Bond network mode configuration
- Apply for SSL certificate, configure SSL certificate for domain name, and deploy server; Download and installation of SSL certificate
猜你喜欢

Sentinel fusing and current limiting

zk-SNARK:关于私钥、环签名、ZKKSP

Experimental reproduction of image classification (reasoning only) based on caffe resnet-50 network

5 years, 1.4W times, NFT og's road to immortality Web3 column

E-commerce operator Xiaobai, how to get started quickly and learn data analysis?

ASEMI整流桥GBU1510参数,GBU1510规格,GBU1510封装

If you want to do a good job in software testing, you can first understand ast, SCA and penetration testing

What is the problem of the time series database that has been developed for 5 years?

深度学习之DAT

redux
随机推荐
Booking.com binke Shanghai noodles
Opencv learning notes - remapping
[深入研究4G/5G/6G专题-42]: URLLC-13-《3GPP URLLC相关协议、规范、技术原理深度解读》-7-低延时技术-1-子载波间隔扩展
Leetcode-202. happy number
[cloud native kubernetes] how to use configmap under kubernetes cluster
5 years, 1.4W times, NFT og's road to immortality Web3 column
用GaussDB(for Redis)存画像,推荐业务轻松降本60%
[unity3d shader] character projection and reflection
Can't the container run? The Internet doesn't have to carry the blame
Course selection information management system based on SSM
Leetcode-462. make the array elements equal with the minimum number of moves
1311_硬件设计_ICT概念、应用以及优缺点学习小结
[in depth study of 4g/5g/6g topic-42]: urllc-13 - in depth interpretation of 3GPP urllc related protocols, specifications and technical principles -7-low delay technology-1-subcarrier spacing expansio
Three solutions: when clicking the user to exit the login, press the back button of the browser, and you can still see the previous login page.
Why are more and more users of Bing search?
Operator new, operator delete supplementary handouts
Brief tutorial for soft exam system architecture designer | case analysis and problem solving skills
redux
MySQL index failure scenarios and Solutions
Save the image with gaussdb (for redis), and the recommended business can easily reduce the cost by 60%