This example highlights the corresponding row when a text marker is clicked. For example, if you click on Melbourne, you will see that the first row is highlighted.
# | Date | Location |
---|---|---|
1 | March 16th | Melbourne |
2 | April 20th | Shanghai |
3 | May 11th | Barcelona |
4 | June 8th | Montréal |
5 | July 6th | Silverstone |
6 | July 27th | Mogyoród |
7 | September 21st | Singapur |
8 | October 12th | Austin |
9 | November 9th | Interlagos |
10 | November 23rd | Abu Dhabi |
We added a table to this map which can be useful to display additional information. We extend the default HTML of this map to the following. A complete version can be found at the end in the map configuration.
<div id="{cssid}"> %%map%% <div class="click-content"> <table class="table"> <tr> <th>#</th> <th>Date</th> <th>Location</th> </tr> <tr class="melbourne"> <td>1</td> <td>March 16th</td> <td>Melbourne</td> </tr> <!-- ... --> </table> </div> </div>
If you click on one of the text markers, you will notice that the corresponding table row is selected. This was achieved by adding the following JavaScript code to the map:
jQuery("#" + cssid + " table tr").removeClass("selected"); jQuery("#" + cssid + " ." + click_value).addClass("selected");
This code is executed everytime one of the markers is clicked. The first line removes the selection and the second sets the selection. Each text marker has its own click value. In this example it contains the CSS class for the table row that we want to highlight. For example, for Melbournce we will set the click value to melbourne
.
The color is set by the following CSS rule:
#{cssid} .selected td { background-color: #e2d8d3; }
This CSS rule will set the background color to #e2d8d3, whenever its row has the class .selected
.
The map configuration can be found here: