0

I'm trying to make a simple map of parcels in TileMill. Right now when I hover over a parcel, the information for that parcel appears in a teaser. That's simple enough. However, when working with particularly small parcels it may not be immediately clear to the user over which parcel one is hovering.

What I would like is for the outline of a particular parcel to glow when it is being hovered over.

I know in CSS there is a :hover selector, but it would seem that either: a) There is not a direct translation in terms for between CSS and CartoCSS for this selector. -or- b)A hover-like selector is not available in CartoCSS.

I've included an example below where I attempted to use the hover selector from CSS. In this case it would seem the hover selector is ignored and the parcel outlines are drawn again using the given attributes. Nonetheless, I offer this faulty example as a potential starting point for any suggestions on how to implement hover features using CartoCSS.

#parcels {
  line-color:#151515;
  line-width:1;
  polygon-opacity: 0.6;
}
#parcels::hover {
  line-color:#0AFF47;
  line-width:1.25;
}

Thanks for any suggestions!

1 Answer 1

2

No - CartoCSS is a language that generates raster tiles. It is read by TileMill, which turns your data into images, and then all your browser sees are images. So there's no CartoCSS language in place when you're just looking at a map. This is why it's super fast for large data. If you need features that change their appearance on hover, it would be best to use Leaflet or Mapbox.js and GeoJSON features in-browser.

Your Answer

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

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