Premium Pro Service Area Map - CA
body {
margin: 0;
font-family: Arial, sans-serif;
}
#map-wrapper {
max-width: 1200px;
margin: auto;
}
#map {
width: 100%;
height: 500px;
border-radius: 18px;
box-shadow: 0 25px 70px rgba(0,0,0,0.2);
}
/* 🔥 MARKER */
.marker {
position: relative;
width: 20px;
height: 20px;
background: #1f78d1;
border-radius: 50%;
cursor: pointer;
}
/* Center dot */
.marker::after {
content: '';
position: absolute;
width: 8px;
height: 8px;
background: white;
border-radius: 50%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
/* Pulse */
.marker::before {
content: '';
position: absolute;
width: 20px;
height: 20px;
border-radius: 50%;
background: rgba(31,120,209,0.4);
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% { transform: scale(1); opacity: 0.7; }
70% { transform: scale(2.5); opacity: 0; }
100% { opacity: 0; }
}
.marker:hover {
transform: scale(1.3);
}
document.addEventListener('DOMContentLoaded', () => {
mapboxgl.accessToken = 'pk.eyJ1IjoidGFpbW9vcmh1c3NhaW43ODkiLCJhIjoiY21leXZ3Y3lzMDE4cjJrczI2NXFycmphMCJ9.0VFpmjUMg0xwRgAM0EM5sA';
const map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/navigation-day-v1',
center: [-118.25, 34.05],
zoom: 9,
pitch: 20
});
map.addControl(new mapboxgl.NavigationControl(), 'bottom-right');
/* LOCATIONS */
const locations = [
["Beverly Hills, CA", -118.4004, 34.0736, "https://lindseyswhimsyfacepainting.com/best-face-painter-in-beverly-hills-ca/"],
["Burbank, CA", -118.3089, 34.1808, "https://lindseyswhimsyfacepainting.com/face-painting-in-burbank-ca/"],
["Encino, CA", -118.5012, 34.1597, "https://lindseyswhimsyfacepainting.com/hair-bar-in-encino-ca/"],
["Manhattan Beach, CA", -118.4109, 33.8847, "https://lindseyswhimsyfacepainting.com/airbrush-tattoo-artist-in-manhattan-beach-ca/"],
["Montecito Heights, CA", -118.2026, 34.0917, "https://lindseyswhimsyfacepainting.com/face-painter-in-montecito-heights-ca/"],
["Pasadena, CA", -118.1445, 34.1478, "https://lindseyswhimsyfacepainting.com/face-painting-in-pasadena-ca/"],
["Porter Ranch, CA", -118.5360, 34.2775, "https://lindseyswhimsyfacepainting.com/face-painter-in-porter-ranch-ca/"],
["Santa Monica, CA", -118.4912, 34.0195, "https://lindseyswhimsyfacepainting.com/airbrush-tattoo-in-santa-monica-ca/"],
["Sherman Oaks, CA", -118.4490, 34.1511, "https://lindseyswhimsyfacepainting.com/hair-bar-in-sherman-oaks-ca/"],
["Thousand Oaks, CA", -118.8376, 34.1706, "https://lindseyswhimsyfacepainting.com/airbrush-tattoo-in-thousand-oaks-ca/"]
];
const popup = new mapboxgl.Popup({
closeButton: false,
closeOnClick: false,
offset: 25
});
function addMarkers() {
const bounds = new mapboxgl.LngLatBounds();
locations.forEach(loc => {
const el = document.createElement('div');
el.className = 'marker';
new mapboxgl.Marker({
element: el,
anchor: 'center' // ✅ FIXED ALIGNMENT
})
.setLngLat([loc[1], loc[2]])
.addTo(map);
bounds.extend([loc[1], loc[2]]);
el.addEventListener('mouseenter', () => {
popup.setLngLat([loc[1], loc[2]]).setText(loc[0]).addTo(map);
});
el.addEventListener('mouseleave', () => {
popup.remove();
});
el.addEventListener('click', () => {
el.style.pointerEvents = "none";
document.body.style.cursor = "wait";
map.flyTo({
center: [loc[1], loc[2]],
zoom: 12,
speed: 0.8
});
setTimeout(() => {
window.location.href = loc[3];
}, 1200);
});
});
return bounds;
}
map.on('load', () => {
const bounds = addMarkers();
map.fitBounds(bounds, { padding: 100 });
});
});