Guest MatheusT Posted January 26, 2020 at 01:42 AM Report Share #617200 Posted January 26, 2020 at 01:42 AM (edited) Olá, eu estou começando a aprender Jquery, alguém poderia me explicar como funciona esse código abaixo? $(function() { menu = $('nav ul'); $('#openup').on('click', function(e) { e.preventDefault(); menu.slideToggle(); }); $(window).resize(function() { var w = $(this).width(); if (w > 480 && menu.is(':hidden')) { menu.removeAttr('style'); } }); $('nav li').on('click', function(e) { var w = $(window).width(); if (w < 480) { menu.slideToggle(); } }); $('.open-menu').height($(window).height()); }); eu tenho a barra de menu em html <header> <nav class='bar'> <ul class='bar'> <li class="screen-small"> <a href="#showcase">Lorem Ipsum</a> </li> <li> <a href='#showcase'>Home</a> </li> <li> <a href='#music'>Music</a> </li> <li> <a href='#video'>Video</a> </li> <li> <a href='#premium'>Premium</a> </li> </ul> <a href='#' id='openup'>myTunes</a> </nav> </header> Edited January 26, 2020 at 02:00 AM by MatheusT Link to comment Share on other sites More sharing options...
N3lson Posted March 31, 2020 at 10:00 AM Report Share #617774 Posted March 31, 2020 at 10:00 AM 1ª Função -> mostrar e esconder menu 2ª Função -> ao redimensionar janela, se o tamanho da mesma for maior que 480px e o menu estiver escondido, então remover o style.css que indica para display: none ou algo do género 3ª Função se clicares no link do menu e se a janela for menor que 480 mostrar ou esconder (depende da situação) 4ª $('.open-menu').height($(window).height()); -> colocar o tamanho da div (menu) do mesmo tamanho da janela visível You can't do it, kid. But don't worry, my boy. You're not the only one. No one else can do it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now