SETTING A MENU TO CLOSE AFTER X AMOUNT OF TIME

Sanjay Sharma

Total Post:45

Points:315
Posted by  Sanjay Sharma
 816  View(s)
Ratings:
Rate this:

$(document).ready(function(showmenu) {

    $('#showmenu').click(function() {

            $('.menu').slideToggle().delay('1000');

    });

});

Where and how would I set a time out to close the menu (which drops down upon click) so that after X amount of time, the menu is hidden again.

  1. Kamlakar Singh

    Post:194

    Points:1396
    Re: Setting a menu to close after X amount of time

    $(document).ready(function(showmenu) {

        $('#showmenu').click(function() {

                $('.menu').slideToggle().delay('1000');

                setTimeout(function(){$('.menu').hide()}, 5000);

        });

    });

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!