<div class="container">
- {% include navbar.html %}
+ {% include navbar.html id="BlogHero" %}
</div>
<section class="hero is-primary">
</span>
</a>
- <div id="navBurger" class="navbar-burger">
+ <div class="navbar-burger burger" data-target="navMenu{{ include.id }}">
<span></span>
<span></span>
<span></span>
</div>
</div>
- <div id="navMenu" class="navbar-menu">
+ <div id="navMenu{{ include.id }}" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item {% if page.route == 'index' %}is-active{% endif %}" href="{{ site.url }}/">
Home
document.addEventListener('DOMContentLoaded', () => {
- // Navbar burger menu
+ // Toggles
- const $navBurger = document.getElementById('navBurger');
- const $navMenu = document.getElementById('navMenu');
+ const $burgers = getAll('.burger');
+ const $fries = getAll('.fries');
- if ($navBurger) {
- $navBurger.addEventListener('click', () => {
- $navBurger.classList.toggle('is-active');
- $navMenu.classList.toggle('is-active');
+ if ($burgers.length > 0) {
+ $burgers.forEach($el => {
+ $el.addEventListener('click', () => {
+ const target = $el.dataset.target;
+ const $target = document.getElementById(target);
+ $el.classList.toggle('is-active');
+ $target.classList.toggle('is-active');
+ });
});
}
{% include head.html %}
<body class="layout-{{ page.layout }}{% if page.doc-tab %} page-{{ page.doc-tab}}{% endif %}">
{{ content }}
+ {% include footer.html %}
</body>
</html>
---
<div class="container">
- {% include navbar.html %}
+ {% include navbar.html id="Documentation" %}
</div>
<section class="hero is-primary">
{% include subnav-components.html %}
{% capture navbar_example %}
-{% include navbar.html %}
+{% include navbar.html id="Example" %}
+{% endcapture %}
+
+{% capture navbar_brand_example %}
+<nav class="navbar">
+ <div class="navbar-brand">
+ <!-- nav items, nav burger ... -->
+ </div>
+</nav>
+{% endcapture %}
+
+{% capture navbar_brand_items_example %}
+<nav class="navbar">
+ <div class="navbar-brand">
+ <a class="navbar-item" href="{{ site.url }}">
+ <img src="{{ site.url }}/images/bulma-logo.png" alt="{{ site.title }}" width="112" height="28">
+ </a>
+
+ <div class="navbar-burger">
+ <span></span>
+ <span></span>
+ <span></span>
+ </div>
+ </div>
+</nav>
{% endcapture %}
<section class="section">
<code>.navbar</code> the <strong>main</strong> container
<ul>
<li>
- <code>.navbar-brand</code> the <strong>left side</strong>, which usually contains the <strong>logo</strong> and optionally some links or icons
+ <code>.navbar-brand</code> the <strong>left side</strong>, <strong class="has-text-success">always visible</strong>, which usually contains the <strong>logo</strong> and optionally some links or icons
<ul>
<li>
<code>.navbar-burger</code> the <strong>hamburger</strong> icon, which toggles the navbar menu on touch devices
{% highlight html %}{{navbar_example}}{% endhighlight %}
+ <hr>
+
+ <h3 class="title">Navbar brand</h3>
+
+ <div class="content">
+ <p>
+ The <code>.navbar-brand</code> is the left side of the navbar. It can contain:
+ </p>
+ <ul>
+ <li>
+ a number of <code>.navbar-item</code>
+ </li>
+ <li>
+ the <code>.navbar-burger</code> as last child
+ </li>
+ </ul>
+ </div>
+
+ {% highlight html %}{{navbar_brand_example}}{% endhighlight %}
+
+ <div class="content">
+ <p>
+ The navbar brand is <strong>always visible</strong>: on both touch devices (< 1000px) and desktop (1000px +). As a result, it is recommended to only use a few navbar items to avoid <strong>overflowing</strong> horizontally on small devices.
+ </p>
+ </div>
+
+ <div class="example is-paddingless">
+ {{navbar_brand_items_example}}
+ </div>
+
+ {% highlight html %}{{navbar_brand_items_example}}{% endhighlight %}
+
</div>
</section>
---
<div class="container">
- {% include navbar.html transparent=true boxed=true %}
+ {% include navbar.html id="Index" transparent=true boxed=true %}
</div>
<section class="hero is-medium has-text-centered">
document.addEventListener('DOMContentLoaded', function () {
- // Navbar burger menu
+ // Toggles
- var $navBurger = document.getElementById('navBurger');
- var $navMenu = document.getElementById('navMenu');
+ var $burgers = getAll('.burger');
+ var $fries = getAll('.fries');
- if ($navBurger) {
- $navBurger.addEventListener('click', function () {
- $navBurger.classList.toggle('is-active');
- $navMenu.classList.toggle('is-active');
+ if ($burgers.length > 0) {
+ $burgers.forEach(function ($el) {
+ $el.addEventListener('click', function () {
+ var target = $el.dataset.target;
+ var $target = document.getElementById(target);
+ $el.classList.toggle('is-active');
+ $target.classList.toggle('is-active');
+ });
});
}