I've simplified your code for better clarity. I removed some parts of your code that were commented out. Additionally, please use viewBox="0 0 959 593"
instead of
width="959px" height="593px" viewBox="none"
. This adjustment will ensure your SVG scales to fit the container which is the body in this scenario.
$description = $(".description");
$('.enabled').hover(function() {
$(this).attr("class", "enabled heyo");
$description.addClass('active');
$description.html($(this).attr('id'));
}, function() {
$description.removeClass('active');
});
html, body {
width: 100%;
}
svg {
width:100vh;
display: block;
border:1px solid;
}
.heyo:hover {
fill: #CC2929;
-moz-transition: 0.3s;
-o-transition: 0.3s;
-webkit-transition: 0.3s;
transition: 0.3s;
}
.enabled {
fill: #21669E;
cursor: pointer;
}
.description {
font-size: 18px;
text-align: center;
background: white;
padding: 10px 15px;
z-index: 5;
height: 30px;
line-height: 30px;
margin: 0 auto;
color: #21669e;
border-radius: 5px;
box-shadow: 0 0 0 1px #eee;
display: none;
}
.description.active {
display: block;
}
.description:after {
content: "";
position: absolute;
left: 50%;
top: 100%;
width: 0;
height: 0;
margin-left: -10px;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid white;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<svg version="1.1" id="Layer_1" viewBox="0 400 959 193" preserveAspectRatio="xMidYMid meet" xml:space="preserve" >
<path id="Alaska" class="enabled" fill="#21669E" stroke="#FFFFFF" stroke-width="0.75" d="M158.1,453.7l-0.3,85.4l1.6,1l3.1,0.2... (SVG Path continues) ... ">
</svg>
<div class="description"></div>
This modification is based on the forked version of your pen: https://codepen.io/enxaneta/pen/87dc4facb04e657fea5c9a5eb7b2ea3c/