Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Google Docs
Each Attachment size should not exceed 1.0 MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Move this topic
Forum :
Getting Started
Using jQuery
Using jQuery Plugins
Using jQuery UI
Developing jQuery Core
Developing jQuery Plugins
Developing jQuery UI
QUnit and Testing
About the jQuery Forum
jQuery Conferences
jQuery Mobile
Developing jQuery Mobile
Sub forum :
Move this topic
Cancel
Using jQuery
jimmee sw..
It is possible to trigger a keyboard shortcut or action with a click?
in
Using jQuery
•
4 years ago
The spacebar key currently scrolls any browser page down if you hit it. It is possible to bind or trigger the spacebar on a click?
$("body").on("click", function(){
var e = jQuery.Event("keydown");
e
.
which
=
32
;
$(this).trigger(e);
});
1
Replies(4)
jakecigar
Re: It is possible to trigger a keyboard shortcut or action with a click?
4 years ago
No. The browser handles that space before javaScript has a chance to see it.
JΛ̊KE
Leave a comment on jakecigar's reply
jakecigar
Re: It is possible to trigger a keyboard shortcut or action with a click?
4 years ago
You can detect or cause a scroll without using a space.
.scroll() | jQuery API Documentation
JΛ̊KE
jimmee sw..
Re: Re: It is possible to trigger a keyboard shortcut or action with a click?
4 years ago
Is there another work around? I'm not interest in the .scroll() but the actual pressing of the spacebar.
Leave a comment on jakecigar's reply
jakecigar
Re: It is possible to trigger a keyboard shortcut or action with a click?
4 years ago
I just found I can prevent/catch it with…
window.addEventListener('keydown', function(e) {
if(e.keyCode == 32 && e.target == document.body) {
e.preventDefault(); console.log(e)
}
});
I doubt I could trigger it. Try a native event on window instead of body.
JΛ̊KE
Leave a comment on jakecigar's reply
Change topic type
Topic Type :
Discussions
Questions
Ideas
Problems
No of days :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Change topic type
Cancel
Link this topic
Provide the permalink of a topic that is related to this topic
Permalink
Save
Close
Reply to jimmee swiss's question
Top
Reply
{"z653894191":[14737000007388238,14737000007388243],"z2950240":[14737000007393271,14737000007393275,14737000007393277]}
Statistics
4
Replies
4093
Views
1
Followers
Tags
Cancel
javascript
click
jquery
Actions
Permalink
Related Posts
[jQuery] Triggering a link with no ...
Javascript function not called on b...
C# click vs jQuery or JavaScript cl...
Spring form select Select/click eve...
how to add input fields and dropdow...