html5 - CSS3 transition glitch in Chrome -
i have simple modal, opens upon :checked input. in firefox , ie transition animation works fine, in chrome glitches (effect not smooth) when shows upon checking input.
demo fiddle: jsfiddle
when remove visibility: hidden
works fine, modal blocks rest of page under neath - no text can selected, no buttons clicked etc.
any ideas on how make transition smooth in chrome?
answer
you declared transform: none;
on modal div
. define rotationx instead, animation has starting , ending point. solves animation issue:
input#switch:checked ~ #test > div { transform: rotatex(0deg); }
http://jsfiddle.net/s8hts3v7/9/
code snippet
#test { position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 9999999; visibility: hidden; } input#switch:checked ~ #test { visibility: visible; } #test > div { background: #fff; width: 300px; height: 100px; padding: 30px; position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; transform: perspective(300px) rotatex(-90deg); transform-origin: top center; transition: 0.4s ease; } input#switch:checked ~ #test > div { transform: rotatex(0deg); } #test > div label { background: #000; color: #fff; display: block; text-align: center; padding: 8px; margin-top: 20px; cursor: pointer; }
<input id="switch" type="checkbox" name="test-chkbox" /> <label for="switch">open modal</label> <div id="test"> <div>lorem ipsum dummy text of printing , typesetting industry. <label for="switch">close modal</label> </div> </div>
Comments
Post a Comment