Skip to content

Commit

Permalink
Converted the dropdown map selector to radio buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
vulture-boy committed Oct 30, 2023
1 parent bd2d537 commit f930e6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
12 changes: 6 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
<div class="menu__content">

<div id="areaList" class="active">
<div><label for="mapSelector">Change Map:</label>
<select name="mapSelector" id="mapSelector" onchange="toggleMapStyle()">
<option value="redrawn">Redrawn</option>
<option value="original">Original</option>
</select>
</div><br>
<div style="text-align: center;">
<input type="radio" id="mapSelectRedrawn" name="mapSelect" value="redrawn" checked onchange="toggleMapStyle()">
<label for="mapSelectRedrawn">Redrawn</label>
<input type="radio" id="mapSelectOriginal" name="mapSelect" value="original" onchange="toggleMapStyle()">
<label for="mapSelectOriginal">Original</label>
</div>
<hr>
<ul id="areas"></ul>
</div>
Expand Down
7 changes: 4 additions & 3 deletions interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,15 @@ function buildMap () {
}

function toggleMapStyle () {
var dropdown = document.getElementById('mapSelector')
var selectRedrawn = document.getElementById('mapSelectRedrawn');
var selectOriginal = document.getElementById('mapSelectOriginal');
var lastMapStyle = currentMapStyle;

if (dropdown.value === "redrawn")
if (selectRedrawn.checked)
{
currentMapStyle = NEW_STYLE_NAME;
}
if (dropdown.value === "original")
if (selectOriginal.checked)
{
currentMapStyle = OLD_STYLE_NAME;
}
Expand Down

0 comments on commit f930e6a

Please sign in to comment.