How can I recreate this masking effect in CSS/JavaScript? -


i'm trying recreate effect shown in gif here. it's fine have 2 separate images - don't need recreate greyscale/blur effect (although can webkit filters) - it's masking i'm having trouble with.

basically i've got carousel slider, , slides left , right, background underneath current slide blurred, make text on top more visible. can't manage keep background in same place slider moves along mask. how can recreate this?

enter image description here

edit: i've managed figure out: http://jsfiddle.net/9xk410wk/18/ used css transforms in opposite directions:

.tile {     -webkit-transform: translate3d(-400px, 0px, 0px); } .blur > div {     -webkit-transform: translate3d(400px, 0px, 0px); } .tile:hover {     -webkit-transform: translate3d(400px, 0px, 0px); } .tile:hover .blur > div {     -webkit-transform: translate3d(-400px, 0px, 0px); } 

you use webkit grayscale filter this:

fiddle (hover on image see effect)

markup

<div class="pic">     <div class="mask">slider</div> </div> 

css

.pic {     width:288px;     height: 214px;     background: url(https://dl.dropboxusercontent.com/u/51558405/pic.png) no-repeat;     position:relative;     overflow: hidden; } .pic:hover  .mask {     -webkit-transform: translate3d(228px, 0, 0);     background-position: 100% 0; } .mask {     width: 60px;     height: 214px;     position: absolute;     left:0;     top:0;     color: #fff;     background: url(https://dl.dropboxusercontent.com/u/51558405/pic.png) 0 0 no-repeat;     -webkit-transition: 1.5s linear;     transition: 1.5s linear;     -webkit-transform: translate3d(0, 0, 0);     -webkit-filter: grayscale(100%);     z-index:1; } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -