- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › [jQuery] I’m figuring out how to make “next’ to another text dialog using keyboard buttons…
Hi all, im new here, i would like to know how to make dialog tree using keyboard buttons, i’ve googled any sites but i found nothing… i decided to post here if anyone can help me.
I tried an experiment, but it uses 2 keyboards i didn’t want it, i would like to make it ONE keyboard key as space button, but i couldn’t it
Imagine it how you do next text dialog using key button Example pic
Thanks in advance!
Try using “fadeToggle()” added to jQuery in version 1.4.4 (the demo had 1.4.0) – updated demo
$(document).keyup(function(event) {
if (event.which === 32) {
$('#kid').fadeToggle(500);
$('#old').fadeToggle(800);
}
});
Awesome! i wonder this number “32” is identified as space button, is that true? how do you know to use that number? anyways, thank you a lot for your help!
Yep, 32 is the ascii value of a space. Here is a list of keys, scroll down until you see green.