---
title: "Setting a menu to close after X amount of time"  
description: "Setting a menu to close after X amount of time"  
author: "Anonymous User"  
published: 2014-11-23  
updated: 2014-11-24  
canonical: https://www.mindstick.com/forum/12681/setting-a-menu-to-close-after-x-amount-of-time  
category: "jquery"  
tags: ["javascript"]  
reading_time: 1 minute  

---

# Setting a menu to close after X amount of time

```
$(document).ready(function(showmenu) {    $('#showmenu').click(function()
{            $('.menu').slideToggle().delay('1000');    });});
```

Where and how would I set a time out to [close](https://yourviews.mindstick.com/story/1687/rubbing-hands-close-up-benefits) the menu (which drops down upon [click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social)) so that after X amount of time, the menu is [hidden](https://www.mindstick.com/forum/2303/skip-validating-field-from-hidden-div) again.

## Replies

### Reply by Anonymous User

```
$(document).ready(function(showmenu) {    $('#showmenu').click(function()
{            $('.menu').slideToggle().delay('1000');            setTimeout(function(){$('.menu').hide()},
5000);    });});
```


---

Original Source: https://www.mindstick.com/forum/12681/setting-a-menu-to-close-after-x-amount-of-time

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
