1

I've successfully made my hamburger menu but I want to be able to close it once i've clicked outside the div, but i've had no luck in doing so.

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>

    $(document).ready(function(){
        $('#sidebar-btn').click(function(){
            $('#sidebar').toggleClass('visible');
        });
    });
blake
  • 61
  • 1
  • 5
  • 1
    Do you want it to close when you click "anywhere else"? Then why are you detecting clicks on sidebar-btn? – Eren Tantekin Aug 13 '17 at 05:14
  • @ErenTantekin Sorry about that i'm new to jQuery, I fixed it by changing #sidebar-btn to html and it works fine now, Thanks for the find. :) – blake Aug 13 '17 at 05:19

0 Answers0