JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
html {
height: 100%;
background-color: rgba(27, 43, 58, 1);
background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%0A%20%20%20%20%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%0A%20%20%20%20%20width%3D%225120%22%20height%3D%222893%22%0A%20%20%20%20%20viewBox%3D%220%200%205120%202893%22%3E%0A%20%20%3Cfilter%20id%3D%22blur%22%20filterUnits%3D%22userSpaceOnUse%22%20color-interpolation-filters%3D%22sRGB%22%3E%0A%20%20%20%20%3CfeGaussianBlur%20stdDeviation%3D%2220%2020%22%20edgeMode%3D%22duplicate%22%20/%3E%0A%20%20%20%20%3CfeComponentTransfer%3E%0A%20%20%20%20%20%20%3CfeFuncA%20type%3D%22discrete%22%20tableValues%3D%221%201%22%20/%3E%0A%20%20%20%20%3C/feComponentTransfer%3E%0A%20%20%3C/filter%3E%0A%20%20%3Cimage%20filter%3D%22url%28%23blur%29%22%0A%20%20%20%20%20%20%20%20%20xlink%3Ahref%3D%22data%3Aimage/jpeg%3Bbase64%2C/9j/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QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ/9oADAMBAAIRAxEAAAH5te1Ln6H5IPOWlKvXybG0Y+b73aP+ct/Q8hNY7rhvVMztPN9L/9oACAEBAAEFAowzwW5Q5RqhbK3ItqW5uMU9U81qW1qcin//2gAIAQMRAT8BlI24AWB4cuIbnFFiH//aAAgBAhEBPwEQZhnHlhLhm5Jcv//aAAgBAQAGPwL+f//EADMQAQADAAICAgICAwEBAAACCwERACExQVFhcYGRobHB8NEQ4fEgMEBQYHCAkKCwwNDg/9oACAEBAAE/IRiwqNnFLsp3H/jzTUKsc1kWb/gl/9oADAMBAAIRAxEAABBtfpqwj//EADMRAQEBAAMAAQIFBQEBAAEBCQEAESExEEFRYSBx8JGBobHRweHxMEBQYHCAkKCwwNDg/9oACAEDEQE/EOAu9JiOsI4Mv//aAAgBAhEBPxAoMijIlxMT/9oACAEBAAE/EAijBsYvirtovWRQBtJ5Ud2gnR3Uo4f1W2ZqV261YSzn3f/Z%22%0A%20%20%20%20%20%20%20%20%20x%3D%220%22%20y%3D%220%22%0A%20%20%20%20%20%20%20%20%20height%3D%22100%25%22%20width%3D%22100%25%22/%3E%0A%3C/svg%3E%0A');
background-position: 50% 0;
background-size: cover;
}
$retina: '(min-resolution: 2dppx)';
$bg-queries: (
'full': '(min-width: 2561px), only screen and (min-height: 1448px)',
'2560': '(max-width: 2560px) and (max-height: 1447px)',
'1200@2x': '(max-width: 2400px) and (max-height: 1356px) and (#{retina})',
'1200': '(max-width: 1200px) and (max-height: 678px)',
'992@2x': '(max-width: 1984px) and (max-height: 1121px) and (#{retina})',
'992': '(max-width: 992px) and (max-height: 561px)',
'768@2x': '(max-width: 1536px) and (max-height: 868px) and (#{retina})',
'768': '(max-width: 768px) and (max-height: 434px)'
);
// Safari doesn't seem to support @keyframes inside @media inside @supports, so
// we have to define the animations at the top level
@each $size, $query in $bg-queries {
@media only screen and #{$query} {
@keyframes sharpen {
from {
background-image: filter(url('http://jacobsmith.io/images/bg-#{$size}.jpg'), blur(40px));
}
to {
background-image: filter(url('http://jacobsmith.io/images/bg-#{$size}.jpg'), blur(0));
}
}
}
}
@supports not (background-image: filter(url('i.jpg'), blur(1px))) {
html {
background-size: cover;
}
@each $size, $query in $bg-queries {
@media only screen and #{$query} {
.is-enhanced {
background-image: url('http://jacobsmith.io/images/bg-#{$size}.jpg');
}
}
}
}
@supports (background-image: filter(url('i.jpg'), blur(1px))) {
html {
will-change: background-image;
}
.is-enhanced {
animation: .5s both sharpen;
}
}
// Inspired by https://css-tricks.com/the-blur-up-technique-for-loading-background-images/
window.onload = function loadStuff() {
var bgStyle, bgSrc, bgLoader, img, el, enhancedClass;
// Quit early if older browser (e.g. IE 8).
if (!('addEventListener' in window) || !('getComputedStyle' in window)) {
return;
}
el = document.documentElement;
enhancedClass = 'is-enhanced';
// this will be a zero-height element to load in the image
bgLoader = document.createElement('div');
bgLoader.classList.add(enhancedClass);
// most browsers won't load the image unless it's actually in the DOM
document.body.appendChild(bgLoader);
// Get the image url based on which media query is applying
bgStyle = getComputedStyle(bgLoader)['background-image'].match(/url\(['"](.+)['"]\)/);
bgSrc = bgStyle && bgStyle[1];
img = new Image();
// instead of just using onload (which fails to fire from time to time),
// add the src immediately and check for whether the image download is
// complete before adding the onload handler
if(bgSrc) {
img.src = bgSrc;
}
function enhance() {
bgLoader.remove();
el.classList.add(enhancedClass);
}
if(img.complete || img.readyState === 'complete') {
enhance();
} else {
img.onload = enhance;
}
}
Also see: Tab Triggers