Adding popups to markers or maps
Almost every mapping application has an ability to display information related to the features shown on it. Showing all the related information on the map at the same time is an impossible mission for a developer and it is also useless for users. Instead of showing all the information on the map, developers add interaction to points, polylines, or polygons that show the related information with different techniques such as popups or info windows.
Popups or info windows can hold anything that can be written in HTML tags, such as pictures, videos, or standard text.
You will see something like the following screenshot, if you get through to the end of the recipe:
Getting ready
This recipe is the modified version of the previous recipe named Adding markers to maps.
You can find the source code at Chapter 3/ch03_adding_popups.html
.
How to do it…
You can easily add popups to markers or maps by performing the following steps:
- First, the
initMap()
function is modified...