Files
bulma/docs/lib/grid.js
Jeremy Thomas 6d9005ad2a Grid init
2018-01-30 14:42:17 +00:00

17 lines
433 B
JavaScript

'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);
}
});