mirror of
https://github.com/jgthms/bulma.git
synced 2024-11-14 11:14:24 +00:00
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
jQuery(document).ready(function ($) {
|
|
|
|
var $grid = $('#grid');
|
|
var $columns = $grid.children('.column');
|
|
var showing = 5;
|
|
var $markup = $('#markup code');
|
|
var $message = $('#message');
|
|
var $add = $('#add');
|
|
var $remove = $('#remove');
|
|
|
|
function showColumns() {
|
|
if (showing === 13) {
|
|
$message.show();
|
|
} else {
|
|
$message.hide();
|
|
}
|
|
|
|
showing = Math.min(Math.max(parseInt(showing), 2), 12);
|
|
|
|
$columns.hide();
|
|
$columns.slice(0, showing).show();
|
|
|
|
$markup.html('<span class="nt"><div</span> <span class="na">class=</span><span class="s">"columns"</span><span class="nt">></span>');
|
|
$markup.append('\n');
|
|
|
|
for(i = 0; i < showing; i++) {
|
|
$markup.append(' <span class="nt"><div</span> <span class="na">class=</span><span class="s">"column"</span><span class="nt">></span>');
|
|
$markup.append(i + 1);
|
|
$markup.append('<span class="nt"></div></span>');
|
|
$markup.append('\n');
|
|
}
|
|
|
|
$markup.append('<span class="nt"></div></span>');
|
|
}
|
|
|
|
$add.click(function() {
|
|
showing++;
|
|
showColumns();
|
|
});
|
|
|
|
$remove.click(function() {
|
|
showing--;
|
|
showColumns();
|
|
});
|
|
|
|
});
|