Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 705921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:06:30+00:00 2026-05-14T04:06:30+00:00

I know this exact question was asked here , but the answer didn’t work

  • 0

I know this exact question was asked here, but the answer didn’t work for what I needed to do so I figured I’d give some example code and explain a bit…

$(document).keypress(
    function (event) {
        // Pressing Up or Right: Advance to next video
        if (event.keyCode == 40 || event.keyCode == 39) {
            event.preventDefault();
            $(".current").next().click();
        }
        // Pressing Down or Left: Back to previous video
        else if (event.keyCode == 38 || event.keyCode == 37) {
            event.preventDefault();
            $(".current").prev().click();
        }
     }
 );

It basically disables the arrow keys to use them for something else, but doing:

$(document).keypress(function () { });

doesn’t enable the default function again… I need it to scroll the page without having to create a scroll function for it…

Any ideas?

Thanks,
Matt

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:06:31+00:00Added an answer on May 14, 2026 at 4:06 am

    I’m not sure this is the right way to handle it.

    A better way to approach this problem would be to put some kind of check inside your document.keypress instructions.. like..

    var enableKeys = false;
    
    $(document).keypress(
        function (event) {
            // Pressing Up or Right: Advance to next video
            if (event.keyCode == 40 || event.keyCode == 39 && enableKeys) {
                event.preventDefault();
    
                $(".current").next().click();
            }
            // Pressing Down or Left: Back to previous video
            else if (event.keyCode == 38 || event.keyCode == 37 && enableKeys) {
                event.preventDefault();
                $(".current").prev().click();
            }
         }
     );
    

    Then control the enablekeys wherever you feel necessary, either with a hover, or something along those lines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this exact question has been asked , but the solution posted there
I know variants of this question have been asked frequently before (see here and
I guess this question that would have already been asked here. I searched but
I don't know if this exact question has been asked, if so I am
I know this question has been asked so many times before but I couldn't
I know this question has asked many times in SO,but i couldn't figure out
This question was asked to me in MS interview. I wanna know the exact
This question has been asked before, but not with this exact issue. I have
Ok guys I know this question has been asked before but I am very
I know this may be a common question but I can't find the exact

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.