[jQuery] Re: Binding a unique single and double click command

2009-10-07 Thread Sam
Thanks for the help! I nailed it with the following: $('.todo_item h2').live('click', function() { clicks++; x = $(this); if (clicks == 1) singleClick = setTimeout(function() { clicks = 0; showExtra(x); }, 300); if (clicks == 2) { clearTimeout(singleClick); clicks

[jQuery] Re: Binding a unique single and double click command

2009-09-30 Thread Liam Potter
in the double click function you'd have to clearTimeout on the first function otherwise it will run anyways. readysalted wrote: I'd use this approach - var clicks = 0; $('.todo_item h2').live('click', function() { // count the click click++; // only set the timeout

[jQuery] Re: Binding a unique single and double click command

2009-09-30 Thread readysalted
I'd use this approach - var clicks = 0; $('.todo_item h2').live('click', function() { // count the click click++; // only set the timeout if the first click to prevent multiple firing if( click == 1) setTimeout( "doTheAction()", 300); }); function doTheAction()