html - Change slowly z-index value after hover has ended on image -


i have blog post set of images enlarged on hover. problem when enlarge element , overlaps other image later in page render order next image on top of enlarged one.

the easy way stop give kind of z-index on :hover pseudo selector. have pesky problem when after stop hovering image next 1 on top of fraction of second.

you can see behaviour in this imgur album or on jsfiddle(hover first image)

in short have following css hovering effect:

.photo-exp { position: relative; transition: .4s ease-in-out;  /* properties deleted have no connection hovering effect */ }  .photo-exp:hover { transform: scale(1.7);  z-index : 10; } 

it easy have same effect javascript , settimeout function.

but avoid javascript solution , have css workaround change z-index in time after hovering ends.

i tried css transition not working
tried eddit this snippet not working in way wanted.

you need assign new transition-delay property, , remove hover begins. way z-index can persist time after mouse gone. it's little counter-intuitive; expect delay should added on hover , removed off-hover opposite works on chrome:

.expander {    position: absolute;    left: 50%; top: 50%;    width: 100px; height: 100px;    margin-top: -50px; margin-left: -50px;    z-index: 1;    transition: transform 400ms 0ms, z-index 0ms 400ms; /* final "400ms" delays z-index transition! */  }  .expander:hover {    transform: scale(1.8);    z-index: 2; /* hovered expander on top */    transition: transform 400ms 0ms, z-index 0ms 0ms; /* remove z-index transition delay on hover. counter-intuitive works. */  }  .expander:nth-child(1) {    margin-left: -105px;    background-color: #a00000;  }  .expander:nth-child(2) {    margin-left: 5px;    background-color: #00af00;  }
<div class="expander"></div>  <div class="expander"></div>

note (unless try mouse around in order break it) neither square bleeds through other, not frame, when expand.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -