另一个下拉菜单中的下拉菜单

时间:2020-09-14 03:16:25

标签: bootstrapper

我有问题。我想在“游戏”下拉菜单中创建一个“我们的选择”下拉菜单,但是我不明白为什么代码不起作用。你们能告诉我问题出在哪里吗?

<div class="collapse navbar-collapse" id="menu">
                <ul class="navbar-nav">
                    <li class="nav-item dropdown">
                            <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">Games</a>
                            <ul class="dropdown-menu games-menu" >
                                <li><a href="latest.html" class="dropdown-item">Latest</a></li>
                                <li><a href="best_selling.html" class="dropdown-item">Best Selling</a></li>
                                <div class="dropdown">
                                    <li><a href="#" class="dropdown-item dropdown-toggle" data-toggle="dropdown">Our Pick</a></li>
                                        <ul class="dropdown-menu games-menu">
                                            <li><a href="2019.html" class="dropdown-item">2019</a></li>
                                            <li><a href="2020.html" class="dropdown-item">2020</a></li>
                                        </ul>
                                </div>   
                            </ul>
                    </li>
          </ul>
</div>

1 个答案:

答案 0 :(得分:1)

您可以简单地在其中嵌套另一个class ProductController extends ProductControllerCore { public function initContent() { if (!$this->product->active) { if (Tools::getValue('adtoken') == Tools::getAdminToken('AdminProducts'.(int)Tab::getIdFromClassName('AdminProducts').(int)Tools::getValue('id_employee')) && $this->product->isAssociatedToShop()) { $this->context->smarty->assign('adminActionDisplay', true); } else { $this->context->smarty->assign('adminActionDisplay', false); if ($this->product->id_product_redirected == $this->product->id) { $this->product->redirect_type = '404'; } switch ($this->product->redirect_type) { case '301': header('HTTP/1.1 301 Moved Permanently'); if (!$this->product->id_product_redirected) {header('Location: '.$this->context->link->getCategoryLink($this->product->id_category_default));} else {header('Location: '.$this->context->link->getProductLink($this->product->id_product_redirected));} exit; break; case '302': header('HTTP/1.1 302 Moved Temporarily'); header('Cache-Control: no-cache'); if (!$this->product->id_product_redirected) {header('Location: '.$this->context->link->getCategoryLink($this->product->id_category_default));} else {header('Location: '.$this->context->link->getProductLink($this->product->id_product_redirected));} exit; break; case '404': default: header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); $this->errors[] = Tools::displayError('This product is no longer available.'); break; } } } } } 并添加另一个嵌套的li并使用自定义CSS在悬停时显示该dropdown

实时工作演示:

dropdown
.sub-menu:hover .games-menu {
  display: block;
}

.sub-menu2:hover .our-pick-menu {
  display: block;
}