javascript - How animate the height of the background image -


i have tried following scenario need animate background image filling bottom top on hover of div. whereas animation not filling bottom instead sliding bottom top. can 1 suggest me right way how can achieve result. ok jquery animation , css3 keyframe animation.

below code fiddle

.bg {    background: url("https://9887c7297bf844d024e4cccb28a722f62dbe3d73.googledrive.com/host/0b6jeeghp1bpxfkszmfvrcdzbdgf4d012d0hjas0xwtrvrkh6sdneufhub2petzlsywztbza/work_home.png") no-repeat center;    height: 250px;    position: relative;  }  span {    background: url(https://9887c7297bf844d024e4cccb28a722f62dbe3d73.googledrive.com/host/0b6jeeghp1bpxfkszmfvrcdzbdgf4d012d0hjas0xwtrvrkh6sdneufhub2petzlsywztbza/work_home_animate.png) no-repeat top 32px center;    bottom: 0px;    height: 0;    transition: height 0.5s;    position: absolute;    right: 0;    left: 0;  }  .bg:hover span {    height: 184px;  }
<div class="bg"><span></span>  </div>

fiddle link

setting background-position bottom helpful:

.bg {    background: url("https://9887c7297bf844d024e4cccb28a722f62dbe3d73.googledrive.com/host/0b6jeeghp1bpxfkszmfvrcdzbdgf4d012d0hjas0xwtrvrkh6sdneufhub2petzlsywztbza/work_home.png") no-repeat center;    height: 250px;    position: relative;  }    span {    background: url(https://9887c7297bf844d024e4cccb28a722f62dbe3d73.googledrive.com/host/0b6jeeghp1bpxfkszmfvrcdzbdgf4d012d0hjas0xwtrvrkh6sdneufhub2petzlsywztbza/work_home_animate.png) no-repeat;    bottom: 0px;    height: 0;    position: absolute;    right: 0;    left: 0;    transition: height .5s;      background-position: center bottom;  }    .bg:hover span {    height: 152px;  }
<div class="bg"><span></span></div>


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -