Skip to content

Instantly share code, notes, and snippets.

View stephanfoxwell's full-sized avatar

Stephan Foxwell stephanfoxwell

View GitHub Profile
@stephanfoxwell
stephanfoxwell / registerTouchables.js
Last active September 4, 2021 15:20
Better :hover / :active effects on mobile
var registerTouchables = () => {
var touchables = document.querySelectorAll('button, button, a[href], label');
let touchablesLength = touchables.length;
while ( touchablesLength-- ) {
touchables[touchablesLength].addEventListener('touchstart', () => {}, {passive: true});
touchables[touchablesLength].addEventListener('touchend', () => {}, {passive: true});
}
}

Keybase proof

I hereby claim:

  • I am stephanfoxwell on github.
  • I am stephanfoxwell (https://keybase.io/stephanfoxwell) on keybase.
  • I have a public key whose fingerprint is 2650 81DF E40D B9A1 032A 9A65 CCB7 F0A3 26B4 E073

To claim this, I am signing this object:

@stephanfoxwell
stephanfoxwell / no-js-to-js.js
Created March 2, 2017 16:02
One liner to replace "no-js" with "js" in <head> class.
document.getElementsByTagName( 'html' )[0].className = document.getElementsByTagName( 'html' )[0].className.replace( /no-js/, 'js' );

Keybase proof

I hereby claim:

  • I am stephansmith on github.
  • I am stephansmith (https://keybase.io/stephansmith) on keybase.
  • I have a public key ASA424GIxwxw0PMOQwMybXr2jfODP0DeYC-EYVu83bkujgo

To claim this, I am signing this object: