thdoan / magnify

A lightweight jQuery magnifying glass zoom plugin.
https://thdoan.github.io/magnify/
MIT License
243 stars 63 forks source link

Cannot read property 'x' of undefined #62

Open sajjadazar opened 5 years ago

sajjadazar commented 5 years ago

hello i'm developing a wordpress theme and when i want to use the jquery.magnify.js, it'll give me this error : Cannot read property 'x' of undefined... and i'm using jquery like this : jQuery(document).ready(function () { jQuery('img').magnify(); }

so can you help me ? thanks a lot

chrilleferna commented 5 years ago

I had the same problem. With that is the error message in Chrome and in Safari the message is TypeError: undefined is not an object (evaluating '$image.data('lastPos').x'). Triggered at line 94

The problem seems to be that I used a slim version of jQuery. When swicthing to the full version things work as they should

sophanox commented 4 years ago

Replace lines 95 and 96 in the the magnify.js source with:

nPosX = $image.offset().left; nPosY = $image.offset().top;

sanjay-makwana-avidbrio commented 3 years ago

@sophanox thanks for a solution but there is no issue all working fine

LibbyJane commented 2 years ago

I was still getting the issue, thanks for the fix @sophanox

sanjay-makwana-avidbrio commented 2 years ago

@LibbyJane what error are you getting ?