When my website/web app displays a picture, I need to allow the users to define ‘hotspots’ on the picture wherever they click. So for example, when the user clicks on a point on the picture – 1cm² around the co-ordinate that was clicked will become a link. To be more specific – when the user clicks there to define the hotspot – a dialog will open asking for a string.
I’m pretty much open to all suggestions as to how I can achieve this but want to steer clear of flash, I know it’d be easily achieved in flash but if I can keep this all javascript/jquery it’d be a huge help.
Thanks a lot for any ideas.
For a bit more context: It will be developed using asp .net C# 4.
I chose a bit of a different approach than what Deceze said.
Here’s the working jsFiddle outlining the process
I really went above and beyond, mostly because deceze really got me thinking.
This is the structure of the table. For our purpose, we named the table ‘coords’
This is the click function for the ‘Overlay’ sitting on top of the image. ->
In the above, we post the top and left values to our file to be parsed out and inserted into the DB. We can also create more relationships here, it’s just the ti of the iceburg.
We define
hotspots.phpas the file to serve / handle our coordinate requests.This is the function to reteive the coordinates on page load and place them into the image.
This is the PHP code we’re using to insert, and parse data retrieved from the DB.
Please note this is only an example, and not intended for production use. Obviously, you’ll have more than 1 image and will need to develop a relationship. Also, the SQL statements I’ve used are vulnerable and should be secured for live use.
Good luck!