Skip to content

Instantly share code, notes, and snippets.

@ralt
Forked from ryankinal/jquery-second-click.js
Created September 28, 2012 19:13
Show Gist options
  • Save ralt/3801611 to your computer and use it in GitHub Desktop.
Save ralt/3801611 to your computer and use it in GitHub Desktop.
jQuery "second click" plugin
// Untested, off-the-cuff
$.fn.secondClick = function(handler)
{
if ( !$( this ).data( 'click' ) ) {
$( this ).data( 'click', 1 );
}
else if ( $( this ).data( 'click' ) === 1 ) {
handler();
$( this ).data( 'click', '' );
}
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment