After reading those two questions:
- How To Add CSS3 Transition With HTML5 details/summary tag reveal?
- How to make <'details'> drop down on mouse hover
I have a new one for you!
Problem
I want an animation on closing event of the <details> tag. I thought that just revert the animation of opening would do the job, but unfortunately, no.
$(function() { $('details').on('mouseover', function() { $(this).attr('open', true); }).on('mouseout', function() { $(this).attr('open', false); }).on('click', function(e) { e.preventDefault(); }) }); details[open] SUMMARY~* { animation: sweepin .5s ease-in-out; } details[close] SUMMARY~* { animation: sweepout .5s ease-in-out; } @keyframes sweepin { 0% { opacity: 0; margin-left: -10px } 100% { opacity: 1; margin-left: 0px } } @keyframes sweepout { 0% { opacity: 1; margin-left: 0px } 100% { opacity: 0; margin-left: -10px } } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <details> <summary>Here my little summary</summary> <p>... Do you want more details?</p> <p>Here have some details!</p> </details> Question
Do you think this is possible?