html5 - webkit-transform breaks z-index on Safari -


problem

i'm trying make layer appear it's wall falling down, revealing layer behind it. i've setup 2 fixed div positions. "wall" div has z-index of 9999, "background" div has z-index of 0;

in webkit browsers (safari/ios) i've tested, seems once animation starts on "wall", z-indexes lost or ignored, causing "wall" layer abruptly disappear behind background div.

any ideas on how preserve z-indexes of layers? in advance!

example code (note: jsfiddle @ bottom)

html code

<div id="wall">     wall </div>  <div id="background">     background </div>  <button id="start" style="float: right;"> flip down </button> 

some javascript enable button

$('#start').click(function(){     alert('should fall down wall, revealing background');     $('#wall').addclass('animated flipdown'); }); 

css code (cribbed animate.css)

#wall{     background-color: #f00;     width: 100px;     height: 100px;     position:fixed;     top:0;     left:0;     z-index: 9999; }  #background{     background-color: #00f;     width: 100px;     height: 100px;      position:fixed;     top:0;     left:0;     z-index: 0; }  .animated {   -webkit-animation-duration: 1s;   animation-duration: 1s;   -webkit-animation-fill-mode: both;   animation-fill-mode: both; }   /*** flipdown ***/  @-webkit-keyframes flipdown {   0% {     -webkit-transform: perspective(400px) rotatex(0deg);     transform: perspective(400px) rotatex(0deg);     -webkit-transform-style: flat;     opacity: 1;   }    100% {     -webkit-transform: perspective(400px) rotatex(90deg);     transform: perspective(400px) rotatex(90deg);     -webkit-transform-style: flat;     opacity: 1;   } }  @keyframes flipdown {   0% {     -webkit-transform: perspective(400px) rotatex(0deg);     -ms-transform: perspective(400px) rotatex(0deg);     transform: perspective(400px) rotatex(0deg);     opacity: 1;   }    100% {     -webkit-transform: perspective(400px) rotatex(90deg);     -ms-transform: perspective(400px) rotatex(90deg);     transform: perspective(400px) rotatex(90deg);     opacity: 0;   } }  .flipdown {     -webkit-animation-name: flipdown;     animation-name: flipdown;     -webkit-backface-visibility: visible !important;     -ms-backface-visibility: visible !important;     backface-visibility: visible !important;     -webkit-transform-origin: bottom;     -ms-transform-origin: bottom;     transform-origin: bottom; } 

jsfiddle

http://jsfiddle.net/3mhe2/2/

check out differences in safari vs chrome.

my rotating element wasn't suitable have neighbour background, fixed applying

transform: translatez(1000px); transform-style: preserve-3d; 

to parent of rotating element. safari thinks it's 1000px infront of background.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -