jQuery Sparkle provides a clean, elegant solution for this by implementing a single-task custom event. By doing this, you can use it just like any other event, therefore:
$('#el').singleclick(function(){}); // or event $('#el').bind('singleclick', function(){});
It also provides custom events for the last and first clicks of a series of clicks. And the lastclick custom event actually passes the number of clicks back! So you could do it!
$('#el').lastclick(function(event,clicks){ if ( clicks === 3 ) alert('Tripple Click!'); });
You can find a suitable demo of what I just said here and the source code to determine the correct sign of the event here . It is open source under the AGPL license, so you can freely take whatever you need without worry! :-) It is also actively developing on a day to day basis, so you will never be short of support.
But the most important thing is the DRY Plugin / Effect Framework, which makes it much easier for you to develop plugins and extensions. Therefore, I hope this helps to achieve this goal!
balupton Jul 16 '10 at 9:11 2010-07-16 09:11
source share