Skip to content

Instantly share code, notes, and snippets.

Avatar
🤑
Looking for work

Barney Carroll barneycarroll

🤑
Looking for work
View GitHub Profile
@barneycarroll
barneycarroll / jquery.target.js
Last active Dec 19, 2015
NB: This code has all sorts of edge cases, and any code that attempts to leverage it on a holistic framework level is likely to run into bugs fast. Do not use. Creates a custom `target` event, matching the CSS `:target` pseudo-selector, which can be used to determine when an element in the page becomes the current target of the URI's fragment id…
View jquery.target.js
/* Provides a jQuery 'target' event that fires in all conditions that would
* result in an element becoming the target of the URI fragment identifier or
* hash as it is often called. It aims to provide a behavioural hook to emulate
* CSS3's :target selector [1] (more here [2] and here [3]: good demos include
* this proof of concept [4] and Wikipedia's styling of targeted footnotes and
* citations [5]).
*
* [1] https://developer.mozilla.org/en-US/docs/Web/CSS/:target
* [2] http://css-tricks.com/on-target/
* [3] http://blog.teamtreehouse.com/stay-on-target
@umpirsky
umpirsky / A.markdown
Last active Sep 12, 2020 — forked from olivierlacan/An_example.markdown
Sublime Text Monokai Sidebar Theme.
View A.markdown
@desandro
desandro / transition-scroll-to.js
Created Dec 4, 2012
Use CSS transitions to scroll to element
View transition-scroll-to.js
( function( window, undefined ) {
'use strict';
// helper function
function capitalize( str ) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
// ========================= getStyleProperty by kangax ===============================
@cowboy
cowboy / isprimitive-no-strict.js
Created Sep 18, 2012
JavaScript: isPrimitive
View isprimitive-no-strict.js
var isPrimitive = function(val) {
return val !== function() { return this; }.call(val);
};
@mbostock
mbostock / .block
Last active Feb 25, 2020
Margin Convention
View .block
license: gpl-3.0
redirect: https://observablehq.com/@d3/margin-convention
You can’t perform that action at this time.