javascript - Jquery Image on Hover make input type file -


while hover icon shows on image. want display icon this

and while click, should allow browse files enter image description here

<input type ='file'> 

how can this?

i tried putting file tag all, didn't worked. how can this?

.profile-img-container {    position: absolute;    width:50%;  }    .profile-img-container img:hover {    opacity: 0.5;    z-index: 501;  }    .profile-img-container img:hover + {    display: block;    z-index: 500;  }    .profile-img-container {    display: none;    position: absolute;    margin-left:43%;    margin-top:40%;  }    .profile-img-container img {    position:absolute;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />  <link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" />  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>    <div class="profile-img-container">    <img src="http://s3.amazonaws.com/37assets/svn/765-default-avatar.png" class="img-thumbnail img-circle img-responsive" />    <i class="fa fa-upload fa-5x"></i>  </div>

fiddle

.profile-img-container {    position: absolute;    /*width:50%;*/    /*border-radius:50%;*/    overflow:hidden;  }    .profile-img-container img:hover {    opacity: 0.5;    z-index: 501;  }    .profile-img-container img:hover + {    display: block;    z-index: 500;  }    .profile-img-container .icon-wrapper {    position: absolute;    bottom:0;    left:0;    background:rgba(0,0,0,0.7);    color:#fff;    text-align:center;    width:100%;    padding:5px;  }    /*.profile-img-container img {  position:absolute;  }*/    /*.profile-img-container {    position:relative;  }*/    input[type="file"] {    opacity:0;    position:absolute;    top:0;    left:0;    width:100%;    height:100%;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />  <link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" />  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>    <div class="profile-img-container img-circle">    <input type="file" />    <img src="http://s3.amazonaws.com/37assets/svn/765-default-avatar.png" class="img-thumbnail img-circle img-responsive" />    <div class="icon-wrapper">      <i class="fa fa-upload fa-5x"></i>    </div>  </div>


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -