India Interactive Map (static)
This is a small static client-side project that displays an interactive India map (SVG) and shows basic state details on hover/focus.
Quick start (local)
- From the repository root open
index.htmlin your browser. On Windows PowerShell you can run:
Start-Process .\index.html- Hover map states or use Tab + Enter/Space to focus and activate.
How the map data works
- The SVG markup lives in
map.svgand is inlined into the page at runtime byscript.js. - Each state is an SVG
<path>with anidmatching a key in thestateDataobject insidescript.js. stateDataprovides the display values: name, capital, area, population.- If
stateDatalacks an entry for a hovered state, a small "No data for this state" badge appears and placeholder values are shown.
How to add or update state data
- Open
script.jsand find thestateDataobject near the top. - Add or edit an entry using the map
idas the key, for example:
stateData['Kerala'] = {
name: 'Kerala',
capital: 'Thiruvananthapuram',
area: '38,863 km²',
population: '35 Million'
};- Save and reload
index.htmlin your browser.
Notes & next steps
- Many paths in
map.svgare currently placeholders (d="..."or empty). Replace them with sanitized pathdvalues from an authoritative SVG source if you want full shape previews for every state. - If you prefer, the SVG can be kept inline in
index.htmlbut separating intomap.svgmakes it easier to edit and reuse.