w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Hamburger Responsive Button Click Event BUG

You need to check that the trigger isnt the hamburger button either like in this fiddle

    $(document).ready(function () {
        var container = $(".responsive-menu");
        var hamburger = $(".hamburger");

        hamburger.on('click', function () {
            container.slideToggle();
            container.addStyle('display:block');
        });

        $(document).on('mouseup', function (e) {

            if (!container.is(e.target) && !hamburger.is(e.target)
&& container.has(e.target).length === 0) // ... nor a descendant of
the container
            {
                container.hide('slow');
            }
        });
    });




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.