Skip to content

Instantly share code, notes, and snippets.

View guidobouman's full-sized avatar

Guido Bouman guidobouman

View GitHub Profile
$ = jQuery
TIMEOUT = 20000
lastTime = (new Date()).getTime()
setInterval ->
currentTime = (new Date()).getTime()
# If timeout was paused (ignoring small
# variations) then trigger the 'wake' event
if currentTime > (lastTime + TIMEOUT + 2000)
@Jpunt
Jpunt / jquery.animate.js
Last active December 18, 2015 04:49
Patch for $.animate to use $.transit when possible, and provide fallbacks for things like translateX/Y.
/*globals $ */
/*
* Patches the jQuery-animate method to use CSS-transitions when possible.
*
* - Depends on $.transit: http://ricostacruz.com/jquery.transit/
* - Degrades gracefully to the original method when transitions aren't supported.
* - Provides fallbacks for translateX/Y's, so { x:10, y:10 } (very smooth) will become { top:10, left:10 } (less smooth) for less capable browsers.
* - 3d-transforms could be enabled with enable3d:true. Example: { x:100, enable3d:true }
* - Transitions could be disabled with enableTransitions:false. Example: { x:100, enableTransitions:false }