How to close sidebar menu when click outside of it using html, css & javascript.

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2022
  • In this video, I will show you how to close a sidebar menu when a user clicks outside of it using HTML, CSS, and JavaScript. This is a great way to improve the user experience of your website or web application.
    We will start by creating an HTML sidebar menu. Then, we will add some CSS to style the sidebar menu. Finally, we will write some JavaScript code that will listen for the click event outside of the sidebar menu and close the menu accordingly.
    For Source Code visit:
    www.maketechstuff.com/
    You may have to search ('menu') on website.
  • ХоббиХобби

Комментарии • 16

  • @mikesalinas6245
    @mikesalinas6245 Месяц назад +1

    Bien explicado... genial el vídeo!! Saluditos desde Mty

  • @farshidmedia
    @farshidmedia 9 месяцев назад +1

    Perfect 👌

  • @verbena0815
    @verbena0815 9 месяцев назад +1

    Finally.. thanks sir ❤️

  • @bigjoshallen
    @bigjoshallen 7 месяцев назад +2

    How come you don't use a links to create the nav bar

  • @KareemNasser07
    @KareemNasser07 6 месяцев назад +1

    It works, thanks

  • @lightingvulture
    @lightingvulture Год назад +1

    thank you

  • @raniranu2601
    @raniranu2601 6 месяцев назад +1

    How know the background music 😂😂😂😂😂😂😂😂😂😂😂

  • @thestar001Official
    @thestar001Official 3 месяца назад +2

    You know you could have just cut out the first part 😏

  • @sogenohata1948
    @sogenohata1948 Год назад +2

    can you simply add ".active" before another class name on CSS, without defining it first on HTML?

    • @Maketechstuffs
      @Maketechstuffs  Год назад +1

      Yes you can add, but if that another class is not in html, then styles will not applied to it. or may be show error, when you add that active class using javascript.

    • @louisestreem
      @louisestreem Месяц назад

      @@Maketechstuffs why it dons't work on mine in vscode i followed the steps but it didn't work broooooooooooooooooooooooooooooooooooooooooooo!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    • @Maketechstuffs
      @Maketechstuffs  Месяц назад

      Source code available on maketechstuff.com website. You can compare both the codes (yours and mines).

  • @FRESHSHOW_RD
    @FRESHSHOW_RD 3 месяца назад

    Please what's the purpose of that .active class you add to it?

    • @Maketechstuffs
      @Maketechstuffs  3 месяца назад

      I've explained in blog post. www.maketechstuff.com/2022/11/close-sidebar-menu-when-click-outside-of-it.html