jquery - trigger event with spacebar keydown for set duration -


i have animation should start on keydown set duration (3s or so).

wondering if can bind animation function jquery keydown how can add duration or if there jquery plugin can handle this?

the animation like:

$('.slide1').slideup();

but need bind key-hold event triggered when holds down spacebar 3s. have no idea begin here.

something - how trigger actual spacebar?

$('spacebar').keydown(   $('.slide1').slideup(); ), 3000) ?  

$(window).keypress(function (e) {   if (e.keycode === 0 || e.keycode === 32) {     e.preventdefault()     console.log('space pressed')     //do stuff here     /*some animation*/.delay(3000);//plays animation 3 seconds   } }); 

as others have commented, hard see looking without example code. sounds looking this.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -