I'm trying to creating a jQuery plugin where the user can interact with a div element background image.
background-image is larger than
div element container, so if the user move the mouse over the div element, the image is automatically scrolled to be seen completely.
I thought to do that by working with this relation, but it is imprecise.
mX : aW = bX(?) : bW
-((mX * bW) / aW) / 2 = bX
this does something near but it isn't precise, how can I find the right way to do the proportion?