How can you change properties with the display of elements using CSS? My current solution is to set a display to block with Javascript, wait 10 milliseconds for repaint, then apply the class that I want to amimate.
Note: I'm using jQuery for code summarize. Javascript is very similar, once you hover over the required element, this "open" square will apply when you hover out, After sometime, the "Open" class will remove. CSS - animating opacity as an example. Do not care about $. Show ().
.element {display: none; Opacity: 0; -WebKit-Infection: all 0.5 s; -Mozy infection: all 0.5 s; -M transition: all 0.5 s; -O-Infection: All 0.5 S; Infection: all 0.5 s; } .element.shown {Opacity: 1; }
javascript
function show () {var $ element = $ ('. Element'); $ Element.css ({display: 'block'}); // Display the class in the block, then add the class after a few seconds, otherwise the animation css changes set timeout (function () ($ element.addClass ('shown');}, 10);} hide the function () $ {Element} = $ ('Element'); $ Element.removeClass ('detected'); // Remove element from transition after transition; $ element ends ('WebCat TransactionAntendedandArtentationAnd' MSRCIndex Transitionand ', F I think that, however, a CSS-only way should be a better way. I just got the workaround. You just need to use the animation and you can see the display. Start it a little bit after applying: block like this:
@keyframes submenu_animation {{from opacity: 0;} 1% {opacity: 0;} 99% {opacity: 1 ;} {Opacity: 1;}} Li Ul Clarity: 0; Do not display anything; Animation-name: submenu_enimation; Animation-period: 300ms; Animation-direction: reverse; Li ul.open {display: block; } Li: Hove ul (Animation-direction: normal; Opacity: 1; }
No comments:
Post a Comment