I’m trying to achieve this effect with jQuery.
I wrote some of the code, but it’s buggy (move to the bottom-right corder and you’ll see).
check it out
Basically, if there’s an already-built jQuery plugin that you know of that does this, I’d be very happy using it, if not, any help with my formula would be appreciated. This is what I get for not paying attention in Maths classes 🙂
Thanks in advance.
Maikel
Overall I think this is what you’re looking for:
You can test it here.
Notable changes:
new_xandnew_yshould be divided by the images height/width, not the container’s height/width, which is wider.thisis already a jQuery object in a$.fn.pluginfunction, no need to wrap it.iandpwere also jQuery objects, no need to keep wrapping themmousemoveonmouseenter(which rebinds) themousemovewill only occur when you’re inside anyway.