mirror of
https://github.com/jgthms/bulma.git
synced 2024-11-28 12:24:23 +00:00
Fix #856
This commit is contained in:
parent
13b730934e
commit
8137c801e9
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### Issues closed
|
### Issues closed
|
||||||
|
|
||||||
|
* Fix #856 JavaScript `nav-burger` example
|
||||||
* Fix #821 Notification strong color
|
* Fix #821 Notification strong color
|
||||||
|
|
||||||
## 0.4.3
|
## 0.4.3
|
||||||
|
@ -67,7 +67,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
const expand = '<button class="expand">Expand</button>';
|
const expand = '<button class="expand">Expand</button>';
|
||||||
$el.insertAdjacentHTML('beforeend', copy);
|
$el.insertAdjacentHTML('beforeend', copy);
|
||||||
|
|
||||||
if ($el.firstElementChild.scrollHeight > 320) {
|
if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
|
||||||
$el.insertAdjacentHTML('beforeend', expand);
|
$el.insertAdjacentHTML('beforeend', expand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,11 +39,14 @@
|
|||||||
margin-bottom: 1.5rem
|
margin-bottom: 1.5rem
|
||||||
|
|
||||||
.highlight pre
|
.highlight pre
|
||||||
max-height: 320px
|
max-height: 480px
|
||||||
margin-bottom: 0 !important
|
margin-bottom: 0 !important
|
||||||
padding: 1.25em 1.5em
|
padding: 0
|
||||||
code
|
code
|
||||||
padding: 0
|
padding: 1.25em 1.5em
|
||||||
|
|
||||||
|
#navbarJsExample .highlight pre
|
||||||
|
max-height: none
|
||||||
|
|
||||||
$structure: $danger
|
$structure: $danger
|
||||||
$structure-invert: $danger-invert
|
$structure-invert: $danger-invert
|
||||||
|
File diff suppressed because one or more lines are too long
@ -339,6 +339,46 @@ doc-subtab: navbar
|
|||||||
<hr class="navbar-divider">
|
<hr class="navbar-divider">
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
|
|
||||||
|
{% capture navbar_js_html %}
|
||||||
|
<div class="navbar-burger" data-target="navMenu">
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="navbar-menu" id="navMenu">
|
||||||
|
<!-- navbar-start, navbar-end... -->
|
||||||
|
</div>
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
|
{% capture navbar_js_code %}
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|
||||||
|
// Get all "nav-burger" elements
|
||||||
|
var $navBurgers = Array.prototype.slice.call(document.querySelectorAll('.nav-burger'), 0);
|
||||||
|
|
||||||
|
// Check if there are any nav burgers
|
||||||
|
if ($navBurgers.length > 0) {
|
||||||
|
|
||||||
|
// Add a click event on each of them
|
||||||
|
$navBurgers.forEach(function ($el) {
|
||||||
|
$el.addEventListener('click', () => {
|
||||||
|
|
||||||
|
// Get the target from the "data-target" attribute
|
||||||
|
var target = $el.dataset.target;
|
||||||
|
var $target = document.getElementById(target);
|
||||||
|
|
||||||
|
// Toggle the class on both the "nav-burger" and the "nav-menu"
|
||||||
|
$el.classList.toggle('is-active');
|
||||||
|
$target.classList.toggle('is-active');
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
<section class="section">
|
<section class="section">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
@ -531,6 +571,25 @@ doc-subtab: navbar
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
<div id="navbarJsExample" class="message is-info">
|
||||||
|
<h4 class="message-header">Javascript toggle</h4>
|
||||||
|
<div class="message-body">
|
||||||
|
<div class="content">
|
||||||
|
<p>
|
||||||
|
The Bulma package <strong>does not come with any JavaScript</strong>.
|
||||||
|
<br>
|
||||||
|
Here is however an implementation example, which toggles the class <code>is-active</code> on both the <code>nav-burger</code> and the targeted <code>nav-menu</code>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% highlight html %}{{ navbar_js_html }}{% endhighlight %}
|
||||||
|
|
||||||
|
{% highlight javascript %}{{ navbar_js_code }}{% endhighlight %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
<h3 class="title">Navbar start and navbar end</h3>
|
<h3 class="title">Navbar start and navbar end</h3>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -69,7 +69,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
var expand = '<button class="expand">Expand</button>';
|
var expand = '<button class="expand">Expand</button>';
|
||||||
$el.insertAdjacentHTML('beforeend', copy);
|
$el.insertAdjacentHTML('beforeend', copy);
|
||||||
|
|
||||||
if ($el.firstElementChild.scrollHeight > 320) {
|
if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
|
||||||
$el.insertAdjacentHTML('beforeend', expand);
|
$el.insertAdjacentHTML('beforeend', expand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
.content
|
.content
|
||||||
+block
|
+block
|
||||||
color: $text
|
|
||||||
// Inline
|
// Inline
|
||||||
li + li
|
li + li
|
||||||
margin-top: 0.25em
|
margin-top: 0.25em
|
||||||
|
Loading…
Reference in New Issue
Block a user