Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @keyframes myAnimation{
- 0%{
- opacity: 1;
- transform: rotateX(90deg);
- }
- 50%{
- opacity: 0.5;
- transform: rotateX(0deg);
- }
- 100%{
- display: none;
- opacity: 0;
- transform: rotateX(90deg);
- }
- }
- #myelement{
- animation-name: myAnimation;
- animation-duration: 2000ms;
- animation-fill-mode: forwards;
- }
- <style>
- #test{
- background: red;
- height: 100px;
- width: 400px;
- transition: height 1s;
- }
- #test.hide {
- height: 0;
- }
- </style>
- <div id="test"> </div>
- <button>Hide the Div</button>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.js"></script>
- <script>
- $('button').click(function(){
- removeWithAnimate('#test');
- });
- function removeWithAnimate(id){
- $(id).addClass('hide');
- setTimeout( function(){
- $(id).remove()
- },1000);;
- }
- </script>
Add Comment
Please, Sign In to add comment