View Single Post
Old 05-06-2012, 12:26 PM   #9
silver18
THE NOOB
silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.
 
silver18's Avatar
 
Posts: 701
Karma: 1545649
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
Here's how I fixed this problem:

Code:
var doubleclicks = 0;
var timer;

function doubleClick () {

	doubleclicks = 0;
	clearTimeout(timer);
	ENTER WHAT DO YOU WANT TO DO HERE
			
}

function simulateDoubleClick () {
			
	doubleclicks = doubleclicks + 1;
	if (timer) clearTimeout(timer);
	timer = setTimeout(function() { singleClick (); }, 550);
		
	if (doubleclicks == 2) {
		doubleClick ();
	}
}

function singleClick() {
	
	ENTER WHAT DO YOU WANT TO DO HERE
			
}
and here's how to call it:

Code:
onClick="simulateDoubleClick ()"
silver18 is offline   Reply With Quote