diff --git a/index.js b/index.js index 8096d0d..a360f0c 100644 --- a/index.js +++ b/index.js @@ -402,12 +402,22 @@ function drawMap(world) { const coordinates = [77.69916967457782,23.389970772934166]; const [xCoord, yCoord] = projection(coordinates); + // Add a listener to toggle the language display when a language is hovered on the map document.querySelectorAll(".language"). forEach(function(element) { element.addEventListener("mouseover", toggleLanguageDisplay); element.addEventListener("mouseout", toggleLanguageDisplay); }); + // Remove all 'g' elements that have no children (they don't have a language, translation, or romanization). This must mean they accidentally got created when I created the 'textItems' variable + document.querySelectorAll("g"). + forEach(function(element) { + if (element.childElementCount == 0) { + element.remove() + } + }); + + // svg.append("text") // .attr("x", xCoord) // .attr("y", yCoord)