Setinterval with exponential time decrease
问题 I've got a mousedown event with a setinterval. I want the time of intervals to be variable. So the first one is 500, the second one 500/2 = 250, etc. Any tips? $plus.mousedown(function(e) { increment(20) timeout = setInterval(function(){ increment(20) }, 500); }); $(document).mouseup(function(){ clearInterval(timeout); return false; }); Cheers! EDIT: sorry for the ambiguity. I want the time of interval to change during the mousedown. So while the mousedown is being performed the intervaltime