Geolokace IP adresy

  1. https://www.geoapify.com/how-to-get-user-location-with-javascript
  2. https://myprojects.geoapify.com/api/BdHWM6AowWOd6XOKPfC2/settings

<script>
fetch('https://api.geoapify.com/v1/ipinfo?apiKey=97a80dcceec54f19b13bef01c9c1bbb2', {
method: 'GET'
})
.then(function(response) { return response.json(); })
.then(function(json) {
var visitor_location = json['country'].iso_code;
$('body').addClass(visitor_location);
});
</script>

---------------------------------------------------------

Popup

#location_switch {display: none;
background: #00ab63;
xxxborder: solid 2px #5a985c;
padding: 20px 35px 20px 20px;
border-radius: 3px;
width: 400px;
max-width: 100%;
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index:1000;
box-shadow: 0 0 7px rgba(0, 0, 0, 0.15);
}
body.CZ #location_switch {display:block;}
#location_switch h3 {
margin-top: 0;
font-size: 18px;
color: #fff;
}
#location_switch a {
background: #ecf1ed;
border-color: #ecf1ed;
}
#location_switch a:hover {
background: #222;
border-color: #222;
color:#fff;
}
#location_switch span {position: absolute;
right: 10px;
top: 3px;
color: #fff;
font-weight: 300;}
#location_switch span:hover {color: #222;}
#location_switch span::before {
content: '\e912';
font-family: shoptet;
}

<script>
$('.switch_close').click(function() {
$('#location_switch').hide();
});
</script>