i use an roundabout script for my project menu. I have some action after menu items click. I want to fire this actions/function after second click at this selected item. Can you help my how to do this?
This is start of my function:
$('.main_content ul li').bind({click: function(){
One way would be to manually cancel the first click:
Demo
Another, perhaps neater, would be to use the
onemethod for binding the listener:Demo
Of course, if it is an actual double click you’re trying to listen to, you should use the
dblclickevent as Tats_innit suggests. That is, if you only want to fire an event upon two clicks in close succession. With doubleclick, three quick clicks would fire the function only once, and with the solutions above, it would fire twice. With doubleclick, two clicks with some delay between them would not cause the function to fire at all, and the seolutions above would cause it to fire once.