Skip to content

Instantly share code, notes, and snippets.

View ScottPolhemus's full-sized avatar

Scott Polhemus ScottPolhemus

View GitHub Profile
@ScottPolhemus
ScottPolhemus / _mixins.scss
Last active August 29, 2015 14:01
A collection of SASS mixins.
// SASS Mixins
// -----------
// Force an element to fill its container
@mixin fill {
position: absolute;
top: 0; bottom: 0;
left: 0; right: 0;
}
@ScottPolhemus
ScottPolhemus / scrollerScroll.js
Last active December 15, 2015 16:59
Scroll property plugin for Stellar.js to use Zynga Scroller for scrolling.
$.stellar.scrollProperty.scrollerScroll = {
getLeft: function($elem) { return scroller.getValues().left; },
setLeft: function($elem, val) { scroller.scrollTo(val); },
getTop: function($elem) { return scroller.getValues().top; },
setTop: function($elem, val) { scroller.scrollTo(null, val); }
}
@ScottPolhemus
ScottPolhemus / typekit-finish.js
Last active May 9, 2016 15:49
Fires a custom event on the page as soon as Typekit finishes loading or fails to load. Add this in place of the standard Typekit.load() snippet to enable listening for the event in your own JS (useful for controlling how text appears on page load).
function triggerTypekitFinish() {
if (typeof window.CustomEvent === 'function') {
var event = new CustomEvent('typekit-finish');
} else {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('typekit-finish', true, true, {});
}
document.documentElement.dispatchEvent(event);
}
try {
@ScottPolhemus
ScottPolhemus / continuallyScroll.js
Created April 20, 2017 16:54
Continually scroll to the bottom of a page
var scrolling
function scrollToBottom() {
if (scrolling)
requestAnimationFrame(scrollToBottom)
window.scrollTo(0, document.body.offsetHeight)
}
function startScrolling() {
@ScottPolhemus
ScottPolhemus / mixins.less
Last active August 12, 2018 20:17
A collection of LESS mixins.
//
// LESS Utility Mixins
// -------------------
// Fill the parent element
.fill(@spacing: 0) {
position: absolute;
top: @spacing; bottom: @spacing;
left: @spacing; right: @spacing;
}