🌍 This code allows you to display an interactive map that can dynamically collect statistical data from the Voxel theme.
💡 Principle
• Loads an SVG map of the world.
• Colours each country according to the number of visits (the more visits → the more opaque the colour).
• Displays a tooltip with the country name and number of visits when hovering over or touching a country.
📌 In short:
A lively and interactive world map 🌍, where each country is coloured according to its visits, with zoom and instant info when hovering over or touching.
BEFORE STARTING 🌏
a. Download the map at : https://mapsvg.com/maps/world
b. Upload it in your Media Library
STEP 1 🛠️
a. Drag the “Action list (VX)” widget into your Elementor template.
b. Add an item and change the text by inserting the file « 1. Action list text.html » (you can also replace @site() with @post() depending on your needs)
c. Loop the item in the « Loop repeater now » section 🔁
d. Assign an ID to the widget in the “Advanced” tab → name it countrystats
e. Add some styling in “Advanced” > CSS 🎨 see the file « 2. Action list styles.css »
STEP 2 : 💻
a. Drag an HTML widget right above and paste the file « 3. Dynamic world map with Voxel stats.html ».
b. Replace [YOUR SVG URL] if the internal URL of the map SVG file previously added
STEP 3 : 🚀
Save your template and preview the result! 👀
// File : 1. Action list text.html
@site(visit_stats.countries.code)
@site(visit_stats.countries.name)
@site(visit_stats.countries.count)
// File : 2. Action list styles.css
selector .countryvisitscount {
background: white;
font-size: 11px;
border-radius: 50px;
border: solid 1px black;
color: black;
font-weight: 600;
padding: 2px 6px;
display: flex;
align-items: center;
height: 18px;
width: auto !important;
justify-content: center;
margin-left: 10px;
}
selector .countrycode {
display: none;
}
selector .countrydata {
display: flex;
}
// File : 3. Dynamic world map with Voxel stats.html
Dynamic world map with Voxel stats
0
Country
No results available
Pour offrir une meilleure expérience, nous utilisons des cookies pour stocker et accéder aux informations des appareils. En consentant, nous pouvons traiter des données comme le comportement de navigation ou les ID uniques. Ne pas consentir peut affecter certaines fonctionnalités.