Skip to content

Instantly share code, notes, and snippets.

@mi-ca
Created August 19, 2020 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mi-ca/d7cfac41a837e43841b1b7593caa5cc0 to your computer and use it in GitHub Desktop.
Save mi-ca/d7cfac41a837e43841b1b7593caa5cc0 to your computer and use it in GitHub Desktop.
Adjust marker size depending on zoom [mapbox]
map.on('zoom', function() {
const z=Math.ceil(map.getZoom());
let scale=1;
if(z<13){
scale=.45;
}else if(z>=13 && z<14){
scale=.6;
}else{
scale=1;
}
// console.log(scale,z);
$('#the_map .marker svg').css('transform','scale('+scale+')');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment