Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zoom with mousewheel #14

Closed
BugHunter2k opened this issue Sep 17, 2014 · 3 comments
Closed

Zoom with mousewheel #14

BugHunter2k opened this issue Sep 17, 2014 · 3 comments

Comments

@BugHunter2k
Copy link

Just had the idea to enable the mousewheel for zooming the image insteat or in addition to the slider. What do you thing is this a good idea or would it confuse the users?

@scottcheng
Copy link
Owner

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.

@scottcheng
Copy link
Owner

Closing due to inactivity.

@JohnPasquet
Copy link

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.
            });
        }`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants