Making the icon appear on top of the photo with a cyan background and with a slight transparency really turned out to be way more difficult than I thought, could I have done it in a better way than this?
dragi-ns
@dragi-nsAll comments
- @RonaldoKashariSubmitted almost 2 years ago@dragi-nsPosted almost 2 years ago
Hi, looks good! I also just finished this challenge.
For the hover effect I have used
::before
and::after
pseudo-elements. You can put a slightly transparent background color on::before
and you can put a background image on::after
, after that you can show them on hover. That's how I did it.Hope this helps!
Marked as helpful1 - @newton-wSubmitted almost 2 years ago
Was not able to add the custom marker icon, tried implementing the FlyTo for when the ip changes the map centers the marker icon.......i need help😂😂 any advice??
I think i'll try out the google maps instead of leaflet
@dragi-nsPosted almost 2 years agoHi, looks good! I also just finished this challenge.
You can add a custom marker with the
Icon
class fromleaflet
package and then you pass that instance to theicon
prop on theMarker
component fromreact-leaflet
package.As for why doesn't map change when the position is updated take a look at this stackoverflow answer.
MapContainer
props are immutable: changing them after they have been set a first time will have no effect on the Map instance or its container. So that means you need to create another component as a child ofMapContainer
that will update map withmap.setView
.Hope this helps!
Marked as helpful0