Skip to content

Instantly share code, notes, and snippets.

Nick narrowdesign

Block or report user

Report or block narrowdesign

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:94d1f78c48102203f68f
character counts
branching on mobile
CSS pseudo classes
narrowdesign / gist:361eb935a42daab5cf4c
Last active Aug 29, 2015
Touch events that behave exactly like mouse events while mouse dragging or touch moving.
View gist:361eb935a42daab5cf4c
// vars to keep track of the "mouse" during touchmove
var mouseX;
var mouseY;
// create the custom events so you can dispatch them later
var touchover = new Event("touchover");
var touchout = new Event("touchout");
var touchup = new Event("touchup");
var element = document.getElementById("dropTargetDivName");
View gist:0b68bf4a535a5c9effe6
Verifying that +nick is my Bitcoin username. You can send me #bitcoin here:
View gist:d1742442a82e4317ac9e
// variables get initialized up here. That way they're accessible from inside any of the functions below.
var playing = false; // nothing is happening until you click
var w = 500; // width of mouth frames
var l = 0; // keep track of left edge position of mouth sprite image
var mouthInterval; // you'll start and stop this below
var fps = 1000/30; // the second number is the fps
var aud = new Audio("audio/theRightTrack.mp3"); // load the audio before playing it
$( document ).ready(function() { // this is just jQuery saying "ready!" and will be in every javascript file you ever make. I put all my events and functions inside it
narrowdesign / boatArrows
Created Mar 14, 2012
Arrow key navigation
View boatArrows
// ADD THIS FOR ARROW KEY NAVIGATION on the home ticks and the photos on sub pages for maximum power!
$(document).bind("keydown", function (e) {
switch (e.keyCode) {
case 37: // LEFT ARROW
// trigger prev tick
case 39: // RIGHT ARROW
// trigger next tick
View ArrowKeyEvents
if (e.keyCode == 37) {
var previous = self.currentX;
self.currentX = self.limitXBounds(self.previousPageX(self.currentX));
if (self.currentX !== previous) {
return false;
}else if (e.keyCode == 39) {
var previous = self.currentX;
You can’t perform that action at this time.