mirror of
https://github.com/jgthms/bulma
synced 2026-03-20 20:24:30 -07:00
Grid init
This commit is contained in:
17
docs/lib/grid.js
Normal file
17
docs/lib/grid.js
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
var $cells = getAll('.cell');
|
||||
|
||||
$cells.forEach(function (el) {
|
||||
var parentWidth = el.parentElement.offsetWidth;
|
||||
var percentage = el.offsetWidth / parentWidth * 100;
|
||||
el.append('' + Math.round(percentage));
|
||||
});
|
||||
|
||||
// Functions
|
||||
function getAll(selector) {
|
||||
return Array.prototype.slice.call(document.querySelectorAll(selector), 0);
|
||||
}
|
||||
});
|
||||
@@ -111,7 +111,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
var $parent = $el.parentNode;
|
||||
if ($parent && $parent.classList.contains('bd-is-more')) {
|
||||
var showEl = '<button class="bd-show"><div><span class="icon"><i class="fa fa-code"></i></span> <strong>Show code</strong></div></button>';
|
||||
var showEl = '<button class="bd-show"><div><span class="icon"><i class="fas fa-code"></i></span> <strong>Show code</strong></div></button>';
|
||||
$el.insertAdjacentHTML('beforeend', showEl);
|
||||
} else if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
|
||||
$el.insertAdjacentHTML('beforeend', expandEl);
|
||||
|
||||
@@ -14,12 +14,12 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
if (fixedBottom) {
|
||||
fixBottomEl.className = 'button is-success';
|
||||
fixBottomElIcon.className = 'fa fa-check-square-o';
|
||||
fixBottomElIcon.className = 'far fa-check-square';
|
||||
rootEl.classList.add('has-navbar-fixed-bottom');
|
||||
navbarBottomEl.classList.remove('is-hidden');
|
||||
} else {
|
||||
fixBottomEl.className = 'button is-link';
|
||||
fixBottomElIcon.className = 'fa fa-square-o';
|
||||
fixBottomElIcon.className = 'far fa-square';
|
||||
rootEl.classList.remove('has-navbar-fixed-bottom');
|
||||
navbarBottomEl.classList.add('is-hidden');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user