css - Transition-delay not working in Chrome and Safari -


edit

i've got working now, i'm still not sure how did fixed it. if understands happening i'd love hear it.


i'm making animated menu icon , it's working great...except middle bar's transition. it's supposed disappear using transition-delay after top , bottom bars come during first animation, , appear after top , bottom ones meet again second 1 (one third of way through in both instances). there no animation on middle bar, transition on background-color property. i've tried both shorthand transition , explicit transition-delay properties. both give exact same results. whole process works great in ie , firefox, fails in chrome , safari, makes me think it's possible webkit issue.

i'm going post relevant code here (since there's 2 hundred lines whole thing). rest available @ codepen. if think should add more code let me know , add more.

css:

#menu label span.icon, #menu.lightbox label span.icon {   height: 5em;   width: 5em;   display: block;   background-color: rgba(255, 255, 255, 1);   background-clip: content-box;   padding: 2em 0;   transition: background-color 0s 1.66s; }  #menu input[type=checkbox]:checked ~ label span.icon {   background: rgba(255, 255, 255, 0);   background-clip: content-box; } 

html:

<form id="menu" name="datechooser">   <input id="toggle" type="checkbox">   <label for="toggle" onclick="addlightbox(this)"><span class="icon"></span></label>   <fieldset>   </fieldset> </form> 

what baffles me i'm using transition-delay elsewhere , it's working fine. use on <fieldset> in order create lightbox effect. in case here's code too:

fieldset {   background: rgba(0, 0, 0, 0);   transition: background 5s, width 0s 5s, height 0s 5s; }  #menu.lightbox input[type=checkbox]:checked ~ fieldset {   background-color: rgba(0, 0, 0, .6);   transition: background 5s; } 

any ideas i'm doing wrong?


just bit more info. i'm using checkbox hack initiate animations/transitions, pseudo elements top , bottom bars, , little bit of javascript keep animations running on load. of seem working fine. i'm using autoprefixer in codepen, i'm pretty sure it's not prefix issue.


here gifs showing correct animation , faulty one.

works properly:

good transition

no delay middle bar:

bad transition

after removing each group of css rules 1 one, found culprit. turns out code causing issue never made onto stackoverflow, in codepen. here's offending bit of code:

css:

#menu input[type=checkbox]:checked ~ label {   margin: 0;   height: 100vh;   width: 100vw;   display: block;   background: rgba(0, 0, 0, 0);   position: relative;   z-index: 99;   top: 0;   left: 0;   cursor: default; } 

html:

<form id="menu" name="datechooser">   <input id="toggle" type="checkbox">   <label for="toggle" onclick="addlightbox(this)"><span class="icon"></span></label>   <fieldset>   </fieldset> </form> 

the issue isn't span.icon, came because it's parent changing whenever checkbox toggled. label's changes immediate, i'm assuming forced span.icon change well. i'm not sure why chrome , safari had issue this, when firefox , ie11 didn't (i got curious , downloaded opera well. failed chrome did).

the fix simple. make sure label set won't disrupt transition (meaning fiddle around until got working). i'd love me understand happening , why it's fixed now, i'm glad it's working.

here's added css rule fixed it:

#menu label {   margin: 0;   display: block; } 

such tiny fix.

here's demo of working code (sped it's not painfully slow).


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -