Skip to content

Instantly share code, notes, and snippets.

- Template Literals
- Destructuring objects
- Destructuring arrays
- Object Literal
- For of loop
- Spread operator
- Rest operator
- Arrow Functions
- Default Params
- Array.includes()
@andyError
andyError / gist:6fede68b01b2a8ccd7928e71eac7a58b
Created November 16, 2017 16:29
CSS Fade and then hide
div > ul {
. . .
visibility:hidden;
opacity:0;
transition:visibility 0s linear 0.5s,opacity 0.5s linear;
}
div:hover > ul {
visibility:visible;
opacity:1;
transition-delay:0s;
var heights = [];
$('.whatevers').each(function(index) {
heights.push($(this).outerHeight())
});
var largest = Math.max.apply(Math, heights);
$('.whatevers').css('min-height', largest + 'px');
html {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
<h1>If you only read one article about cakes this year – make it this one</h1>
<p>A small paragraph to show <em>emphasis</em> and <strong>important</strong> bits.</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit <a href="#">amet quam egestas semper</a>. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<p>Curabitur at risus sed tellus tristique bibendum nec sed urna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent malesuada aliquet quam quis efficitur. Curabitur et quam sollicitudin neque varius laoreet. Aenean non condimentum libero, convallis aliquam est. Suspendisse rhoncus consectetur posuere. Sed dapibus luctus sapien eget varius. Nulla sed felis id risus iaculis mollis. Mauris pulvinar nisl vitae leo euismod, sit amet viverra massa vehicula.</p>
<h2>How to choose the
html {
position: relative;
min-height: 100%;
}
body {
margin: 0 0 100px; /* bottom = footer height */
}
footer {
position: absolute;
left: 0;
@andyError
andyError / gist:1acbd9e9b3004d6ace27
Last active July 26, 2017 15:42
Scroll smoothly to #hash
$('nav a[href^="#"]').on('click',function (e) {
e.preventDefault();
var target = this.hash,
$target = $(target);
var distanceBetween = $target.offset().top - $(document).scrollTop();
var animationLength = Math.abs(distanceBetween * 0.25);
$('html, body').stop().animate({