Home > DeveloperSection > Forums > Setting a menu to close after X amount of time
Sanjay Sharma
Sanjay Sharma

Total Post:45

Points:315
Posted on    November-23-2014 10:14 PM

 JQuery JavaScript 
Ratings:


 1 Reply(s)
 536  View(s)
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.



Kamlakar Singh
Kamlakar Singh

Total Post:194

Points:1396
Posted on    November-24-2014 12:09 AM

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

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

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

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

    });

});


Don't want to miss updates? Please click the below button!

Follow MindStick