0

I have created a map of pedestrian collisions in Toronto in CartoDB. I would like the border of each neighbourhood to be outlined in a dark colour on hover. Is it possible to modify the CSS to achieve that effect?

1 Answer 1

1

That would not be possible from within the CartoDB Editor. You would need to create a custom map using cartodb.js

Also, as maps are created by requesting tiles, changing the style properties on hover may result a bit laggy. Your app would need to change the cartoCSS for the sublayer on hover, request new tiles and redraw the map. There is an example here.

There is also another option that would involve using Leaflet in order to work with vector geometries that could be restyled on the fly. You would need to retrieve the geometries, store them in a L.GeoJSON object, then manage to pair the hovered CartoDB feature with it's vectorial equivalent and change its style properties. Find an example here

Hope you find this helpful

1
  • I used the Leaflet option and it works perfectly. Here is an example I created - the10and3.com/TorontoPublicTransit.html
    – zgall1
    Commented Mar 25, 2016 at 4:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.