Jump to content
ttkieno

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

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

Share this post


Link to post
Share on other sites
22 минуты назад, prived сказал:

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

 

Screenshot_3.png

Share this post


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

Share this post


Link to post
Share on other sites

или убрать класс dropdown ;)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×

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.