Skip to content

Conversation

Rakibul-GDN
Copy link

Changed This:
const x = ((e.pageX - offsetLeft) / parseInt(width, 10)) * 100 const y = ((e.pageY - offsetTop) / parseInt(height, 10)) * 100
To This:
const x = ((e.screenX - offsetLeft) / parseInt(width, 10)) * 100 const y = ((e.screenY - offsetTop) / parseInt(height, 10)) * 100

Because, when we use multiple react-img-zoom components on the same page, the behavior of the component changes as the page height increases. We don't want that. We want the behavior to stay the same for all the components. So using screen value instead of page value to make sure it stays the same.

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

Successfully merging this pull request may close these issues.

1 participant