Coder Social home page Coder Social logo

Zoom with mousewheel about cropit HOT 3 CLOSED

scottcheng avatar scottcheng commented on August 15, 2024
Zoom with mousewheel

from cropit.

Comments (3)

JohnPasquet avatar JohnPasquet commented on August 15, 2024 1

It's a good point to not interfere with the native behavior of mousewheels on the entire page, but scrolling while over the image itself seems like that is a common behavior.

I was able to get this working, at least in Chrome. It binds to the div for just the image, so the scrolling works on the rest of the page and only impacts scrolling on the image itself.

function BindMouseWheelScrollEvents() {
    $('#divID').bind('mousewheel', function (e) {
            e.preventDefault();

                    var $slider = $(".cropit-image-zoom-input");
                    var currVal = parseFloat($slider.val());
                    var increment = (e.originalEvent.wheelDelta > 0) ? 0.1 : (0.1 * -1);
                    var newVal = currVal + increment;

                    $slider.val(newVal);
                    slider.trigger("change"); // This triggers the CropIt code for slider/range changes.
            });
        }`

from cropit.

scottcheng avatar scottcheng commented on August 15, 2024

I'd say it could be useful in some cases as an option, but it also interferes with the native behavior of mousewheels, which is scrolling the web page. In general I don't think it's a good-to-have but not an essential feature.

from cropit.

scottcheng avatar scottcheng commented on August 15, 2024

Closing due to inactivity.

from cropit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.