in this part we define state that is sat on menu-->style-->margin-bottom , so in first load 'margin-bottomof menu is -145 ( beneath body ) , after this we need to toggle menu'smargin-bottom` with 0 and -145 by clicking on menu divider
the menutoggle function is calling by menu divider and each time check and change the state that is margin-bottom of the menu by that transition-duration: 2s; in CSS part menu toggle smoothly between margin-bottom = 0px and margin-bottom = -145px
we wanna create this menu :
piece of cake ? maybe ...
first of all I have created this 3 icons :
| |
now we need to add them instead of our router texts : ( I have created 3 routs Allies/Castel/War before for learning how check here )
html
lets check this up :
:style="{'margin-bottom': state}"
we create a function to control states of menu ( up/down ) for learning it click heredivider is calling the function menutoggle by clicking
CSS
the most important thing in this code is
transition-duration: 2s;
that causes smooth animation for menuscript
this is most important part lets divide it :
in this part we define state that is sat on menu-->style-->margin-bottom , so in first load 'margin-bottom
of menu is -145 ( beneath body ) , after this we need to toggle menu's
margin-bottom` with 0 and -145 by clicking on menu dividerthe
menutoggle
function is calling by menu divider and each time check and change the state that ismargin-bottom
of the menu by thattransition-duration: 2s;
in CSS part menu toggle smoothly betweenmargin-bottom = 0px
andmargin-bottom = -145px
piece of cake , wasn't it ?