I have a box built via html borders.
I want to connect the bottom left corner to the top right corner with a diagonal line. Either with html/css or by using a background image, doesn’t matter. I’ll figure that part out later.
------
- /-
- / -
- / -
-/----
Here’s the tricky part: I want a different thing to happen depending on which side of the line the mouse is hovering over. I’ll do something like make some text visible or change the background color.
Is that possible in web programing? I’ve thought of doing a “Riemann sum” type calculation with a bunch of invisible divs. Any easier way?
Thanks!
You need to get mouseX and mouseY positions, div bottom and left coordinates, and solve a simple linear equaion:
code:
And that’s it. You only need to add checkClick as handler of onmouseover and set imageWidth and imageHeight