3
I’m making an effect for MENU using CSS and jQuery.
Problem
The transition
works from the element to itself with action hover
.
Otherwise it doesn’t work.
The CSS below does the following:
There is a Mobile MENU hidden to the left of the site. And when I use a jQuery function to call the class .showMenu
, MENU runs to position left:0
. But when I click back on the button that performs the jQuery function, the MENU does not come back the way it came - running.
THE MENU SIMPLY DISAPPEARS.
// CSS
nav#menu-navigation{
position:fixed;
background-color: #FFF;
width: 80%;
max-width: 256px;
height: 70%;
top: 0;
left: -400px;
bottom: 20px;
margin: auto;
overflow: auto;
transition: left 0.3s ease;
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
&.show-menu{
left: 0px;
z-index: 1;
transition: left 0.3s ease;
}
}
// jQuery
$(document).ready(function(){
$('.open-menu').on('click tap', function(){
$('nav#menu-navigation, main').toggleClass('show-menu');
});
});
Looks like that’s it, huh. I had it fixed. I put a
transition: all .3s ease-in-out
in thehover
and it worked. But to improve performance at the very least I used your solution.– Diego Souza