javascript - List jQuery elements listening for a trigger. -


how find out elements on page listening jquery event?

i'm trying write script move tiles on site: http://threesjs.com/. tried send keypress event arrow keys, didn't work:

$('*').trigger(jquery.event('keypress',{which:$.ui.keycode.up})); 

and:

var e=jquery.event('keypress'); e.which=39; $('*').trigger(e); 

the tiles move when arrow keys on keyboard pressed, , should sending keypress elements, board doesn't react when executing in console. think best way trigger board movement find out element listening key down event.

a better way manually triggering jquery events pull out handlers callable functions. this:

function handlearrow(direction){   // code here }  // handlers keypress $(document).on('keypress',function(){   var direction = /*find out key*/;   handlearrow(direction); });  // manual trigger handlearrow('left'); 

(insert standard globals , namespacing warning here) :p


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -