Menu is not going to hide when I click on menu and if there is no link to another url (I am using #). How to hide the menu container (class="menu-box")

    <div class="fr menu-wrap-container">
    <div class="menu-wrapper fr">
    <dl id="menu">
        <dt class="menu dropdown"><a href="javascript:void(0)"></a></dt>
        <dd class="menu-box">
            <a href="<?php echo $this->getUrl('');?>" title="<?php echo $this->__('Home'); ?>" class="home_link"><?php echo $this->__('Home'); ?><span class="spnIndicator fr">&nbsp;</span></a>

            <ul class="links">
                <li class="first"><a href="<?php  echo $this->getUrl('').'#viewproductlist'; ?>">View Products</a></li>
                <li class=""><a href="<?php  echo $this->getUrl('').'delivery-and-returns'; ?>">Delivery & Returns</a></li>
                <li class="">
                    <a href="<?php  echo $this->getUrl(''); ?>">Product Advice</a>
                <li class=""><a href="<?php  echo $this->getUrl(''); ?>">Services</a></li>
                <li class="last"><a href="<?php  echo $this->getUrl('').'about'; ?>">About Us</a></li>
            <?php echo $this->getChildHtml('topLinks') ?>
            <ul class="links">
                <li class="first"><a href="<?php  echo $this->getUrl('').'contact-to-us'; ?>" class="linkcontactico">Contact Us</a></li>
            <?php //echo $this->getChildHtml('checkoutLinks') ?>
            <?php echo $this->getChildHtml('accountLinks') ?>
<div class="cart-icon fr <?php echo $this->getInCart() ? 'active' : '' ?>">
    <a href="<?php  echo $this->getUrl('checkout/cart'); ?>"><?php  echo $this->getChildHtml('topCart') ?></a>
<div class="clearfix"></div>

I have mentioned '#viewproductlist' as href in one of the menu from menu list. And this will link to same page.

  • on which class or id click you want to hide menu-box? – Qaisar Satti Jan 19 '16 at 11:02
  • 1
    use javascript/jquery to add a css class with display: none when you click on it – Robin Jan 19 '16 at 11:07
  • when I click on menu, menu options(container) are opening..one of the option contain (#name), which when click, goes to the bottom of the same page..It is going to the bottom, but the menu container are not hiding.. – AKSHAYA KUMAR Satapathy Jan 19 '16 at 11:07
  • can you add the id on that option? – Qaisar Satti Jan 19 '16 at 11:17

add id on that <li class="first"><a href="<?php echo $this->getUrl('').'#viewproductlist'; ?>" id="special">View Products</a></li> also on that <dd class="menu-box" id="special-menu">

$("special").observe('click', function() {
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.