CSS translate() property not working on :active selector -
so have cool little radial menu pops out of when click fab. took lot of animations , trial , error, since noob, worked wanted to. realised transform(3px, 3px) added 1 of :active properties not work. quite puzzling me, exact same animation added fab , works fine there. can see whole thing in action here: (https://codepen.io/bggrieco/pen/emzrlw?editors=0100), commented out shadow animation, works, bring attention fact translate(3px, 3px) not happen.
relevant code of works , doesn't:
#fab { position: absolute; color: white; font-size: 26px; text-align: center; width: 100%; height: 15%; background-color: #6eadea; border-radius: 50%; box-shadow: 6px 10px 18px #686868; display: none; z-index: 1; } #fab:active { transform: translate(3px, 3px); box-shadow: 4px 6px 12px #585858; }
^ works fine ^
#top { position: absolute; top: 0%; left: 34.5%; color: black; font-size: 26px; text-align: center; border-radius: 50%; width: 30%; height: 30%; background-color: #ffffff; box-shadow: 6px 16px 24px #999999; } #top:active { transform: translate(3px, 3px); /*box-shadow: 6px 10px 18px #686868; commented out focus on problem*/ }
^ nada, nej, niet, zilch ^
i pray internet gods not making fool of myself (again) totally forgetting comma or semicolon somewhere.
the transform:translate isn't working on element because element has another, inline transform style set on it, , inline styles (usually) take precedence on styles defined in css. take @ chrome inspector:
it looks setting in javascript. rememeber, transform properties act one, if need multiple transforms both scale , translate becomes:
transform: translate(3px, 3px) scale(0, 0);
you won't able override transform property current javascript, recommend putting scale in css.
Comments
Post a Comment