I program an online booking system for a scout campsite. What I'm trying to create is an interactive site map where people wishing to book can simply click the pitch they wish to camp on.
So far, I've got the image map extracting the coordinates from my SQL Database and colouring the AREA according to whether the pitch is already booked for that date range or not.
https://www.drumhill.org.uk/test-map.asp?startDate=2021-11-05&endDate=2021-11-08
What I'm struggling with is that, for the green (=available) pitches, I'd like these to change to yellow or something when clicked (=selected) and then back to green again if clicked again (=deselected).
I've seen that there's an example in the documentation that does exactly what I want: https://projects.davidlynch.org/maphilight/docs/demo_features.html The "star" shows exactly the behavior that I want... but I think my lack of JavaScript (or jQuery) knowledge is holding me back a bit.
You are very close to receiving the desired result.
Pass the options to the method when initializing the plugin for that element, on the current page.
This initialize the maphilight plugin for all img elements on the current page, with a class "map". Remember to tweak the colours to your liking :-)
Just tried it on your website, by running inside the developer console:
All your custom colours appear to be working when selecting elements.