I am making an image slider for my company and that when you hover over the image, depending on whether the mouse is on the right half or the left half of the image, a tiny overlay appears on that corresponding side of the image with a next image link.
I can't seem to wrap my head around how to detect whether a mouse is on left side or the right side of the image. I looked into offset but that's an element's offset relative to the document. Now I could do it by getting the elements offset and subtracting the offset of the mouse from offset of the container element on hover, but there seems like there has to be a much better, more reliable way.
Any help would be much appreciated!
If it helps, right now (for beta) the image sizes are static, 400px by 300px.
Thanks!