Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
454 views
in Technique[技术] by (71.8m points)

javascript - Space bar not working in form fields

I am using a template to build a one page portfolio site. The contact form is acting very strange. I cannot enter space in any of the contact fields.

I'm using the following jQuery plugins:

  • Gallerific
  • PikaChoose
  • Fancybox

When you focus in on the message field, it does not allow you to use any spaces. Any ideas on why the spacebar doesn't work?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

jquery.gallerific.js implements a page-wide keydown handler that captures the spacebar and stops it from functioning.

934 if (this.enableKeyboardNavigation) {
935  $(document).keydown(function(e) {
936   var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
937   switch(key) {
938    case 32: // space
939     gallery.next();
940     e.preventDefault();
941     break;

If you scroll back to the gallery portion of the document while still focusing the form, you will notice that pressing the spacebar progresses to the next image.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...