Snippets Map

Bootstrap 5 Route Map with Curved Lines

A dotted map of Europe and the North Atlantic with curved routes fanning out from London, plus controls to adjust the curve and move the arrowheads.

Bootstrap 5 No jQuery Nov 2019 2.1K views

<section class="wdw-stage">
  <div class="container" style="max-width: 1080px">
    <div class="wdw-card overflow-hidden">
      <div class="d-flex flex-column flex-lg-row align-items-lg-center gap-3 p-4 border-bottom">
        <div class="me-lg-auto">
          <span class="wdw-eyebrow">Route map</span>
          <h1 class="wdw-heading h4 mb-0">Flights out of London</h1>
        </div>
        <div class="d-flex align-items-center gap-3">
          <label for="rmCurve" class="small fw-semibold mb-0">Curve</label>
          <input type="range" class="form-range rm-range" id="rmCurve" min="0" max="0.6" step="0.01" value="0.3" aria-valuetext="Curve 50%">
          <output id="rmCurveText" class="small text-body-secondary rm-out" aria-live="polite">Curve 50%</output>
        </div>
        <div class="btn-group rm-seg" role="group" aria-label="Arrow position">
          <input type="radio" class="btn-check" name="rmArrow" id="rmMid" value="middle" autocomplete="off" checked>
          <label class="btn btn-outline-primary btn-sm rounded-start-pill px-3" for="rmMid">Middle</label>
          <input type="radio" class="btn-check" name="rmArrow" id="rmEnd" value="end" autocomplete="off">
          <label class="btn btn-outline-primary btn-sm rounded-end-pill px-3" for="rmEnd">End</label>
        </div>
      </div>
      <div class="rm-map p-2 p-md-4">
        <svg id="rmSvg" viewBox="0 0 1000 480" class="w-100 h-auto d-block rm-svg" role="group" aria-label="Map of Europe and the North Atlantic with curved routes from London to eight cities. Focus a city to highlight its route."></svg>
        <p class="d-sm-none small text-body-secondary text-center mb-0 mt-2">Also flying to Reykjavik and New York (off this map).</p>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.

Free to use in personal and commercial projects under the MIT license.