I'm creating a menu with three levels for my store in opencart 3.0, the whole programming part I've already done, with your help here. Now, I'm having trouble adjusting CSS, as I need the menus displayed to cascade, but the opencart menu default does not cascade, it's opening all at once, as in the example below.
I need to leave something like this.
The code in my menu.twig looks like this:
{% if categories %}
<div class="container">
<nav id="menu" class="navbar">
<div class="navbar-header"><span id="category" class="visible-xs">{{ 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">
{% for category in categories %}
{% if category.children %}
<li class="dropdown"><a href="{{ category.href }}" class="dropdown-toggle" data-toggle="dropdown"><b>
<div style="font-size: 15px;">{{ category.name }}</div>
</b></a>
<div class="dropdown-menu">
<div class="dropdown-inner"> {% for children in category.children|batch(category.children|length / category.column|round(1, 'ceil')) %}
<ul class="list-unstyled">
{% for child in children %}
<li>{{ child.name }}
// begin changes
<ul class="dropdown-menu sub-menu dropdown-inner">
{% set children2 = child.children2 %}
{% for child2 in children2 %}
<li> <a href="{{ child2.href }}" >{{ child2.name }}</a> </li>
{% endfor %}
</ul>
// end changes
</li>
{% endfor %}
</ul>
{% endfor %} </div>
{{ text_all }} {{ category.name }} </div>
</li>
{% else %}
<li>{{ category.name }}</li>
{% endif %}
{% endfor %}
</ul>
</div>
</nav>
</div>
{% endif %}
Does Opencart 3.0 already have CSS classes for this? How to make?
In this file:
catalog/view/theme/default/stylesheet/stylesheet.css
Find:
#menu .dropdown:hover .dropdown-menu {
display: block;
}
Replace with:
#menu .dropdown:hover > .dropdown-menu {
display: block;
}
#menu ul ul ul.dropdown-inner {
left: 100%;
top: 0;
display: none;
}
#menu .nav li {
position: relative;
}
#menu ul ul li:hover ul.dropdown-inner {
display: block;
}
Related
stack community I'm completely an amateur in HTML, Liquid, Adx, in short programming and applying logic, don't have great understanding.
Im not sure why the <span> Test2 </span> is appearing 2x, as you can see from the image,
I want to achieve the following, Test2 new name? as one text and the left Test2 don't want it to be displayed. Please advise.
{% assign homeurl = website.adx_partialurl %}
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div id="navbar" class="navbar-collapse collapse">
{% assign primary_nav = weblinks["Primary Navigation"] %}
{% if primary_nav %}
<div class="data-weblinks-maxdepth="">
<ul class="nav navbar-nav weblinks" role="menubar">
{% for link in primary_nav.weblinks %}
<li role="none" class="weblink {% if sublinks.size > 0 %} dropdown{% endif %}">
<a role="menuitem" aria-label="{{ link.name | escape }}" {%- if link.tooltip %} title="{{ link.tooltip | escape }}"
{% endif %}>
<span> Test2 </span>
{%- unless link.display_image_only -%}
{{ link.name | escape }}
{%- endunless -%}
</a>
</li>
{% endfor %}
</ul>
{% editable primary_nav %}
</div>
{% endif %}
</div>
</div>
</div>
To change the name of the link and perhaps add something in front of it all you have to do is add something into the if clause like below:
{% assign homeurl = website.adx_partialurl %}
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div id="navbar" class="navbar-collapse collapse">
{% assign primary_nav = weblinks["Primary Navigation"] %}
{% if primary_nav %}
<div class="data-weblinks-maxdepth="">
<ul class="nav navbar-nav weblinks" role="menubar">
{% for link in primary_nav.weblinks %}
<li role="none" class="weblink {% if sublinks.size > 0 %} dropdown{% endif %}">
<a role="menuitem" aria-label="{{ link.name | escape }}" {%- if link.tooltip %} title="{{ link.tooltip | escape }}"{% endif %}>
{%- unless link.display_image_only -%}
Text 2 {{ link.name | escape }}
{%- endunless -%}
</a>
</li>
{% endfor %}
</ul>
{% editable primary_nav %}
</div>
{% endif %}
</div>
</div>
</div>
How do I make the the first nav pill in my nav active?
I've tried adding class="active", but that just makes all nav pills active.
<div class="container-fluid bg-dark">
<div class="container text-center menu-meals">
<ul class="nav nav-pills center-pills">
{% for menu in menus %}
{% if menu.mealtype %}
<li role="presentation">{{ menu.mealtype }}</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
Got it working by adding id="menu-meals" to my and then added a script.
<script>
$(function () {
$('#menu-meals li:eq(0) a').tab('show');
});
</script>
I'm using a desk drawer for my page when it's in phone. But for some reason when I try out the links inside the desk drawer on mobile, they won't work. I was hoping anyone could give me a hint as to what I'm doing wrong.
Because it works when I try it on the computer on Chrome while simulating a phone browser but not in my phone's browser. The page is www.bebe2go.com and the desk drawer I'm using is this one: http://git.blivesta.com/drawer/fixed-navbar-left.
Here is the code for the navigator:
<div class="row">
<div class="col-lg-12">
<div class="drawer-header">
<button type="button" class="drawer-toggle drawer-hamburger">
<span class="sr-only">toggle navigation</span>
<span class="drawer-hamburger-icon"></span>
</button>
</div>
<div class="drawer-main drawer-navbar-default">
<nav class="container drawer-nav" role="navigation">
<div class="drawer-brand hidden-md hidden-lg">Bebe2Go</div>
<ul class="drawer-menu">
{% for link in linklists.main-menu.links %}
{% assign child_list_handle = link.title | handleize %}
{% if linklists[child_list_handle].links != blank %}
<li class="drawer-menu-item dropdown drawer-dropdown-hover">
{{ link.title | escape }}<span class="caret"></span>
<ul class="drawer-submenu dropdown-menu" role="menu">
<li class="drawer-submenu-item">{{ link.title | escape }}</li>
{% for childlink in linklists[child_list_handle].links %}
<li class="drawer-submenu-item">{{ childlink.title | escape }}</li>
{% endfor %}
</ul>
</li>
{% else %}
<li class="drawer-menu-item">{{ link.title | escape }}</li>
{% endif %}
{% endfor %}
</ul>
</nav>
</div>
</div>
</div>
Here is the link for the js: https://github.com/blivesta/drawer/blob/master/src/js/jquery.drawer.js
and here the link to the css:
https://github.com/blivesta/drawer/blob/master/dist/css/drawer.css
I am struggling to adjust the height of the navbar for mobile devices on the Shopify platform. I am using Bootstrap v2.1.0 if it makes a difference. Here is the HTML for the navbar:
<div class="navbar{% if settings.inverse_color %} navbar-inverse{% endif %} navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<!-- COLLAPSE BUTTON -->
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="nav-collapse collapse">
<!-- LOGO IN NAV BAR -->
{% if settings.logo_position == 'header' %}
{% if settings.use_logo_image %}
<a class="logo logo-header-image fl hidden-tablet hidden-phone" href="/" title="{{ shop.name }}">
<img src="{{ 'header_logo.png' | asset_url }}" alt="{{ shop.name }} Logo">
</a>
{% else %}
{{ shop.name }}
{% endif %}
{% endif %}
<!-- MAIN NAVIGATION -->
<ul class="nav">
{% for link in linklists.main-menu.links %}
{% capture child_list_handle %}{{ link.title | handle }}{% endcapture %}
{% if linklists[child_list_handle] and linklists[child_list_handle].links.size > 0 %}
<li class="dropdown{% if link.active %} active{% endif %}" id="menu{{ forloop.index }}" >
<a class="dropdown-toggle" data-toggle="dropdown" href="#menu{{ forloop.index }}" title="View {{ link.title }}">
{{ link.title }}
<b class="caret"></b>
</a>
I've tried the solutions here
Decreasing height of bootstrap 3.0 navbar & Custom height Bootstrap's navbar but have been unsuccessful.
This is what I've tried adding to my CSS under mobile:
.navbar-nav > li > a { padding-top: 5px !important; padding-bottom: 5px !important; }
.navbar .brand { padding-top: 5px !important; padding-bottom: 5px !important; }
.navbar-inverse, .navbar-fixed-top, .navbar, .navbar-inner { min-height: 35px !important; }
Thank you in advance!
Remember bootstrap is mobile - first and you have to reference for anything above that. So simply adding .navbar {height: /* your height!important; */ should do the trick. You may need to add #media (min-width :768px) to change it back to original but that is at most.
I have a problem with ie 7 and nested lists - this looks freaky deformed.
This is screenshot
HTML (Django template)
{% for category in category_list %}
<ul class='cat_post_container'>
<li class='cat_name' >
{{ category }}
</li>
<ul>
{% for post in category.postpages_set.all %}
<a class='post_name' href="{{ post.get_absolute_url }}">
<li class='post_name'>
{{ post.title }}
</li>
</a>
{% endfor %}
{% for repost in category.redirectpost_set.all %}
<a class='post_name' href="{{ repost.redirect_url }}">
<li class='post_name'>
{{ repost.title }}
</li>
</a>
{% endfor %}
</ul>
</ul>
{% endfor %}
CSS
.cat_post_container {
border-bottom: groove 2px rgba(52, 90, 113, .3);
}
.cat_name {
line-height: 40px;
height: 40px;
margin-top: 15px;
}
.post_name {
text-decoration: none;
width: 100%;
height: 30px;
line-height: 30px;
border-top: groove 2px rgba(52, 90, 113, .3);
color: #FFED93;
}
.post_name a {
text-decoration: none;
color: #FFED93;
position: relative;
}
What the problem with this? How to make behave it normally?
move inner ul under the li because now you have not valid HTML
probably something like this (have no chance to check it):
{% for category in category_list %}
<ul class='cat_post_container'>
<li class='cat_name' >
{{ category }}
<ul>
{% for post in category.postpages_set.all %}
<li class='post_name'>
<a class='post_name' href="{{ post.get_absolute_url }}">
{{ post.title }}
</a>
</li>
{% endfor %}
{% for repost in category.redirectpost_set.all %}
<li class='post_name'>
<a class='post_name' href="{{ repost.redirect_url }}">
{{ repost.title }}
</a>
</li>
{% endfor %}
</ul>
</li>
</ul>
{% endfor %}