Css:
1 . Upload-img{2 width:80%;3 position:fixed;4 Top:50%;5 Left:50%;6 Margin-left:-40%;7 #fff;8 Border-radius:10px;9 Z-index: +;Ten Display:None; One} A . Upload-img>p:first-child{ - Height:50px; - Line-height:50px; the Border-bottom:2px solid #ccc; - padding:0 20px; - font-size:2.2rem; -} + #open-picture, #open-camera{ - Height:40px; + Line-height:40px; A padding:0 20px; at font-size:2rem; - cursor:Pointer; -} - #open-picture{ - Border-bottom:1px solid #ccc; -} in . Mask{ - background:#000; to Opacity:0.8; + width:100%; - Height:100%; the Z-index:999; * position:fixed; $ Top:0;Panax Notoginseng Left:0; - Display:None; the} + A #picture, #camera{ the position:Absolute; + Top:0px; - Left:0px; $ width:100%; $ Height:100%; - margin:0px; - Opacity:0; the Filter:"Alpha (opacity=0)"; - Filter:Alpha (opacity=0);Wuyi -moz-opacity:0; the}
Html:
1 <P><imgsrc= "Path address of the default display picture"ID= "img"></P>2 <formAction=""ID= "Upload-img"runat= "Server"Method= "POST"enctype= "Multipart/form-data">3 <Divclass= "Upload-img">4 <P>Uploading photos</P>5 <Divstyle= "position:relative;">6 <PID= "Open-picture"><spanclass= "Glyphicon glyphicon-picture rMar10"></span>Album</P>7 <inputtype= "File"name= "Picture"Capture= "Camera"ID= "Picture"/>8 </Div>9 <Divstyle= "position:relative;">Ten <PID= "Open-camera"><spanclass= "Glyphicon glyphicon-camera rMar10"></span>Photo</P> One <inputtype= "File"name= "Camera"Accept= "image/*"ID= "Camera"/> A </Div> - </Div> - </form>
Js:
1 $ ("#img"). Click (function () {2 $ (". Upload-img"). Show (); 3 $ (". Mask"). Show (); 4 }); 5 $ (". Mask"). Click (function () {6 $ (". Mask"). Hide (); 7 $ (". Upload-img"). Hide (); 8 });
Open albums and upload pictures on mobile