Add columns section

This commit is contained in:
Jeremy Thomas
2017-08-14 18:25:14 +01:00
parent ab5a72b202
commit 6fe43b8f94
39 changed files with 2669 additions and 2070 deletions

View File

@@ -1,65 +0,0 @@
jQuery(document).ready(function ($) {
var $toggle = $('#nav-toggle');
var $menu = $('#nav-menu');
$toggle.click(function() {
$(this).toggleClass('is-active');
$menu.toggleClass('is-active');
});
$('.modal-button').click(function() {
var target = $(this).data('target');
$('html').addClass('is-clipped');
$(target).addClass('is-active');
});
$('.modal-background, .modal-close').click(function() {
$('html').removeClass('is-clipped');
$(this).parent().removeClass('is-active');
});
$('.modal-card-head .delete, .modal-card-foot .button').click(function() {
$('html').removeClass('is-clipped');
$('#modal-ter').removeClass('is-active');
});
$(document).on('keyup',function(e) {
if (e.keyCode == 27) {
$('html').removeClass('is-clipped');
$('.modal').removeClass('is-active');
}
});
var $highlights = $('.highlight');
$highlights.each(function() {
var $el = $(this);
var copy = '<button class="bd-copy">Copy</button>';
var expand = '<button class="bd-expand">Expand</button>';
$el.append(copy);
if ($el.find('pre code').innerHeight() > 600) {
$el.append(expand);
}
});
var $highlightButtons = $('.highlight .bd-copy, .highlight .bd-expand');
$highlightButtons.hover(function() {
$(this).parent().css('box-shadow', '0 0 0 1px #ed6c63');
}, function() {
$(this).parent().css('box-shadow', 'none');
});
$('.highlight .bd-expand').click(function() {
$(this).parent().children('pre').css('max-height', 'none');
});
new Clipboard('.bd-copy', {
target: function(trigger) {
return trigger.previousSibling;
}
});
});

View File

@@ -103,8 +103,8 @@ document.addEventListener('DOMContentLoaded', () => {
if ($highlights.length > 0) {
$highlights.forEach($el => {
const copy = '<button class="bd-copy">Copy</button>';
const expand = '<button class="bd-expand">Expand</button>';
const copy = '<button class="button is-small bd-copy">Copy</button>';
const expand = '<button class="button is-small bd-expand">Expand</button>';
$el.insertAdjacentHTML('beforeend', copy);
if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
@@ -123,11 +123,11 @@ document.addEventListener('DOMContentLoaded', () => {
$highlightButtons.forEach($el => {
$el.addEventListener('mouseenter', () => {
$el.parentNode.style.boxShadow = '0 0 0 1px #ed6c63';
$el.parentNode.classList.add('bd-is-hovering');
});
$el.addEventListener('mouseleave', () => {
$el.parentNode.style.boxShadow = 'none';
$el.parentNode.classList.remove('bd-is-hovering');
});
});