溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

手機端上傳相冊圖片

發(fā)布時間:2020-08-01 06:45:05 來源:網(wǎng)絡(luò) 閱讀:290 作者:蓓蕾心晴 欄目:開發(fā)技術(shù)

css:

.upload-img{
    width:80%;
    position:fixed;
    top:50%;
    left:50%;
    margin-left:-40%;
    background-color: #fff;
    border-radius: 10px;
    z-index:1000;
    display:none;
}
.upload-img>p:first-child{
    height:50px;
    line-height: 50px;
    border-bottom:2px solid #ccc;
    padding:0 20px;
    font-size: 2.2rem;
}
#open-picture,#open-camera{
    height:40px;
    line-height: 40px;
    padding:0 20px;
    font-size: 2rem;
    cursor: pointer;
}
#open-picture{
    border-bottom:1px solid #ccc;
}
.mask{
    background:#000;
    opacity: 0.8;
    width:100%;
    height:100%;
    z-index:999;
    position: fixed;
    top:0;
    left:0;
    display: none;
}

#picture,#camera{
    position:absolute;
    top:0px;
    left:0px;
    width:100%;
    height:100%;
    margin:0px;
    opacity: 0;
    filter: "alpha(opacity=0)";
    filter: alpha(opacity=0);
    -moz-opacity: 0;
}

html:

<p><img src="默認(rèn)顯示圖片的路徑地址" id="img"></p>
<form action="" id="upload-img" runat="server" method="post" enctype="multipart/form-data">
    <div class="upload-img">
        <p>上傳照片</p>
        <div >
            <p id="open-picture"><span class="glyphicon glyphicon-picture rMar10"></span>相冊</p>
            <input type="file" name="picture"  capture="camera" id="picture"/>
        </div>
        <div >
            <p id="open-camera"><span class="glyphicon glyphicon-camera rMar10"></span>拍照</p>
            <input type="file" name="camera" accept="p_w_picpath/*" id="camera"/>
        </div>
    </div>
</form>

js:

$("#img").click(function(){
    $(".upload-img").show();
    $(".mask").show();
});
$(".mask").click(function(){
    $(".mask").hide();
    $(".upload-img").hide();
});


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI