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

How to properly making it work when the image is not occupying 100% of the container width? #8

Open
hanoii opened this issue May 3, 2014 · 1 comment

Comments

@hanoii
Copy link

hanoii commented May 3, 2014

I have an image inside a fixed height/width container, even if I wrap it up in the wrapper element, that element also get the full width, but the image is smaller and is center.

When I hover over the image, the lens is all the way to the left of the image.

Is there a way I can properly use this plugin in such a case?

@sfkaos
Copy link

sfkaos commented Feb 15, 2015

@hanoii Not sure if you care anymore, but to try and fix this I hijack the position of the lens in the onthumbmove event and use the offset of the thumb to reposition the x value like this:

    onthumbmove: function (event) {        
        var thumb = $( "#thumb" );
        var offset = thumb.offset();
        $("#thumb-lens").css({left:(event.x - (offset.left/2)), position:'absolute'});
    }

Probably not the cleanest solution but simple and easy.

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

2 participants