You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!DOCTYPE html><html><head><style>#algeria-map-69-wilaya {
width:100%;
height: auto;
}
.cls-1 {
fill:#bcbec0;
stroke:#333;
stroke-width:2;
cursor: pointer;
transition: fill 0.3s;
}
.cls-1:hover {
fill:#2ecc71;
}
</style></head><body><divid="map-container"><!-- Include the SVG file here --></div></body></html>
JavaScript Interaction
// Get all wilaya pathsconstwilayas=document.querySelectorAll('#algeria-map-69-wilaya path');// Add click event to each wilayawilayas.forEach(wilaya=>{wilaya.addEventListener('click',function(){constid=this.id;constname=this.getAttribute('data-name');constnameLatin=this.getAttribute('data-name-latin');constnameArabic=this.getAttribute('data-name-ar');console.log(`Clicked: ${nameLatin} (${nameArabic}) - ID: ${id}`);});});// Highlight specific wilaya by IDfunctionhighlightWilaya(wilayaId){constwilaya=document.getElementById(wilayaId);if(wilaya){wilaya.style.fill='#e74c3c';}}// Example: Highlight Algiers (16)highlightWilaya('16');
// Color wilayas based on dataconstpopulationData={'16': 3000000,// Algiers'05': 1200000,// Batna// ... more data};functioncolorByPopulation(data){Object.keys(data).forEach(wilayaId=>{constwilaya=document.getElementById(wilayaId);constpopulation=data[wilayaId];// Color gradient based on populationconstintensity=Math.min(population/3000000,1);constcolor=`rgba(231, 76, 60, ${intensity})`;wilaya.style.fill=color;});}colorByPopulation(populationData);