javascript - Animation @keyframes slide top and stay -


this question has answer here:

i want #upmenu stay outside viewport once animation ended.

i'm struggling understand doing wrong.

thanks help.

$(document.body).ready(function() {    $("#num").hover(function() {      $("#upmenu").toggleclass("toptop"), $("#fp-nav").toggleclass("top")    })  })
#upmenu{    position:fixed;    top:0;  }  .toptop {    -webkit-animation: slide-out-top 1.5s cubic-bezier(.215, .61, .355, 1);    animation: slide-out-top 1.5s cubic-bezier(.215, .61, .355, 1)  }  @-webkit-keyframes slide-out-top {      0% {          -webkit-transform: translatey(0);          transform: translatey(0)      }      {          -webkit-transform: translatey(-100%);          transform: translatey(-100%)      }  }  @keyframes slide-out-top {      0% {          -webkit-transform: translatey(0);          transform: translatey(0)      }      {          -webkit-transform: translatey(-100%);          transform: translatey(-100%)      }  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <div id=upmenu>1234567890</div><br><br>  <div id=num>hover here</div>

you can achieve setting animation-fill-mode forwards. in case of code use animation shorthand rule, it's last property in list on each line:

$(document.body).ready(function() {    $("#num").hover(function() {      $("#upmenu").toggleclass("toptop"), $("#fp-nav").toggleclass("top")    })  })
#upmenu {    position: fixed;    top: 0;  }  .toptop {    -webkit-animation: slide-out-top 1.5s cubic-bezier(.215, .61, .355, 1) forwards;    animation: slide-out-top 1.5s cubic-bezier(.215, .61, .355, 1) forwards;  }  @-webkit-keyframes slide-out-top {    0% {      -webkit-transform: translatey(0);      transform: translatey(0)    }    {      -webkit-transform: translatey(-100%);      transform: translatey(-100%)    }  }  @keyframes slide-out-top {    0% {      -webkit-transform: translatey(0);      transform: translatey(0)    }    {      -webkit-transform: translatey(-100%);      transform: translatey(-100%)    }  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <div id=upmenu>1234567890</div>  <br>  <br>  <div id=num>hover here</div>


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -