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

  • Home
  • SEARCH
  • 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 6702823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:05:56+00:00 2026-05-26T07:05:56+00:00

In most browsers on linux, CTRL +(WHEEL)SCROLL allows the user to zoom in and

  • 0

In most browsers on linux, CTRL+(WHEEL)SCROLL allows the user to zoom in and out of the page by enlarging or shrinking the size of all elements. Now I want to override this behaviour and get CTRL+WHEEL to zoom into an SVG element I have by applying affine transformations.

Is this possible? Specifically, is it possible to catch this keyboard/mouse event as well as suppressing the browser’s default behaviour?

  • 1 1 Answer
  • 0 Views
  • 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-26T07:05:56+00:00Added an answer on May 26, 2026 at 7:05 am

    There are a lot of difficulties in a question like this. Basically, there are two steps:

    1. Listen for the keydown and keyup events, and keep track of when Ctrl is down
    2. Listen for the mouse wheel, and (if Ctrl is down) do what you want

    But here are the problems you have to address:

    • How are you going to apply the event listeners/handlers?
    • According to QuirksMode, browsers on Mac don’t return an accurate keycode for Ctrl.
    • Also according to QuirksMode, Firefox doesn’t support the mousewheel event. You’ll have to use DOMMouseScroll instead.
    • According to the MDC, there are some instances where the DOMMouseScroll event, when used with Ctrl, never even gets fired!

    I’m not saying they’re insurmountable, or even that they’re big problems. Using a good JavaScript library should abstract away most of them, if not all. Being selective in your choice of browsers/OSs to support will also help quite a bit, if that’s doable.

    If I were to do this with jQuery (and a jQuery mousewheel plugin), it would look something like this:

    (function ($) {
        var isCtrl = false;
    
        function ctrlCheck(e) {
            if (e.which === 17) {
                isCtrl = e.type === 'keydown' ? true : false;
            }
        }
    
        function wheelCheck(e, delta) {
            // `delta` will be the distance that the page would have scrolled;
            // might be useful for increasing the SVG size, might not
            if (isCtrl) {
                e.preventDefault();
                yourResizeMethod(delta);
            }
        }
    
        $(document).
            keydown(ctrlCheck).
            keyup(ctrlCheck).
            mousewheel(wheelCheck);
    }(jQuery));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Now that most of the major browsers support full page zoom (at present, the
Most browsers cache form input values. So when the user refreshes a page, the
On my site, the page displays incorrectly in most browsers until you refresh it.
When double-clicking on a html page most browsers select the word you double-click on
It looks like in most browsers, an <input type=submit> treats both [spacebar] and [enter]
I have a jQuery select which works in most browsers axcept IE. The code
Most popular browsers, while rendering an image, they display it line-by-line top-to-bottom as it
Most web browsers support only HTTP methods like GET and POST and do not
Now that most modern browsers support AJAX and client-side requests without performing a POST,
If I've tested my pages in most major browsers, why would I need to

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.