Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Sign Up

[Решено] Под одной кнопкой все меню.


Recommended Posts

Здравствуйте. Не могли бы подсказать. Хочу в меню при нажатии на пункт "Каталог" отображать все категории. Пытаюсь изменить header.tpl, там ведь меню выводится. Пытаюсь засунуть все в новое меню, но не получается. Может такой вопрос  стоял у кого-нибудь?

<nav id="red" class="navbar">
    <div class="container">
    <div class="navbar-header"><span id="category" class="visible-xs"><?php echo $text_category; ?></span>
      <button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"><i class="fa fa-bars"></i></button>
    </div>
    <div class="collapse navbar-collapse navbar-ex1-collapse">
      <ul class="nav navbar-nav">
        <?php foreach ($categories as $category) { ?>
        <?php if ($category['children']) { ?>
        <li class="dropdown"><a href="<?php echo $category['href']; ?>" class="dropdown-toggle" data-toggle="dropdown"><?php echo $category['name']; ?></a>
          <div class="dropdown-menu">
            <div class="dropdown-inner">
              <?php foreach (array_chunk($category['children'], ceil(count($category['children']) / $category['column'])) as $children) { ?>
              <ul class="list-unstyled">
                <?php foreach ($children as $child) { ?>
                <li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
                <?php } ?>
              </ul>
              <?php } ?>
            </div>
            <a href="<?php echo $category['href']; ?>" class="see-all"><?php echo $text_all; ?> <?php echo $category['name']; ?></a> </div>
        </li>
        <?php } else { ?>
        <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
        <?php } ?>
        <?php } ?>
      </ul>
    </div>
     </div>  
   </nav>

<?php } ?>

 

Screenshot_2.png

Edited by ttkieno
Link to post
Share on other sites

22 минуты назад, prived сказал:

Класс!!! Спасибо большое. Один маленький вопрос. Все получается, как надо. Но при наведении он открывает и категории и подкатегории. Без клика на пункт.
Можно это как-то исправить?

 

Screenshot_3.png

Link to post
Share on other sites

jQuery('ul.nav > li').hover(function() {
jQuery(this).find('.dropdown-menu').stop(true, true).delay(10).fadeIn();
}, function() {
jQuery(this).find('.dropdown-menu').stop(true, true).delay(10).fadeOut();
})

 

Edited by prived
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.