How to create a jQuery function to pull the menu up?

Asked

Viewed 99 times

0

inserir a descrição da imagem aqui

Would you like to use jQuery to go up and down this menu. Can you help me? The end result should be this ... I started the code but no longer know how to continue.

$("#esconder_menu").on("click", function(){
     // #header-main <---- esse é o id do menu a subir.
});

inserir a descrição da imagem aqui

  • Just decrease the height element. If you want to hide it completely define 0, or leave 10 or 15 px.

1 answer

4


You did not give many details, but if only the animation of collecting the menu is missing, the slideUp() must solve:

$("#esconder_menu").on("click", function(){
     $('#header-main').slideUp();
});
  • Slideup totally disappears with the block, I wouldn’t want it to disappear, just climb to the height of the second figure.

  • 1

    Without knowing the HTML of this excerpt can not answer more than this...

  • Basically you need to apply the slideUp only the part that is to disappear. If it is not separated in your HTML, wrap in a div.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.