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
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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