score:1

Accepted answer

Here's the implementation:

Plunker

paths.on('click', function (d) {
          var state = d.state.replace(/\s+/g, '_'),
            offset = $('svg.state.'+state).offset();
          $('html, body').animate({
            scrollTop: offset.top, scrollLeft: offset.left
          });
        });

And of course, included jQuery:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

Let me know if this helps. :)


Related Query

More Query from same tag