I'm building a google map with clickable markers with the marker info hide in div elements. I want to have each marker toggle the "hide" class I created.
Here is how my Map renders:
render() {
if (!this.props.loaded) {
return <div>Loading...</div>
}
return (
<div style={style}>
<div className="profile-container">
<div className="marker-profile hide">
<h1>{this.state.selectedPlace.name}</h1>
<h5>{this.state.selectedPlace.tag}</h5>
<h5>{this.state.selectedPlace.hours}</h5>
<h5>{this.state.selectedPlace.address}</h5>
<p><a href={this.state.selectedPlace.website} className="enter">{this.state.selectedPlace.website}</a></p>
</div>
</div>
<Map
item
xs={12}
google={this.props.google}
onClick={this.onMapClick}
zoom={13}
initialCenter={{ lat: 39.3643, lng: -74.4229 }}>
<Marker
onClick={this.onMarkerClick}
title={'The marker`s title will appear as a tooltip.'}
name={'Salvation Army'}
address={'22 S. Texas Avenue'}
hours={'Mon-Fri 9am-11:45am & 1pm-3pm'}
phone={'609-344-0660'}
website={'https://www.salvationarmy.org'}
position={{lat: 39.3549, lng: -74.4429}} />
<Marker
onClick={this.onMarkerClick}
title={'The marker`s title will appear as a tooltip.'}
name={'Turning Point'}
tag={'Day Center for Homeless'}
address={'1717 Bishop Richard Allen Avenue'}
hours={'Mon-Sat 8am-10pm & 2pm-1pm'}
phone={'609-428-6163'}
website={'https://www.facebook.com/TurningPointDayCenter'}
position={{lat: 39.3656463, lng: -74.43630430000002}} />
<Marker
onClick={this.onMarkerClick}
title={'The marker`s title will appear as a tooltip.'}
name={'Zion Redevelopment'}
address={'525 Atlantic Avenue'}
hours={'Wed 11am-1pm'}
phone={'609-348-9304'}
position={{lat: 39.366664, lng: -74.41770839999998}} />
<Marker
onClick={this.onMarkerClick}
title={'The marker`s title will appear as a tooltip.'}
name={'AC Rescue Mission'}
address={'2009 Bacharach Boulevard'}
hours={'Mon-Sun 10-11:30am'}
phone={'609-345-5517'}
website={'https://www.acrescuemission.org'}
position={{lat: 39.3650061, lng: -74.44001409999998}} />
</Map>
</div>
)}}
I was trying to use jQuery to create the click event, but for some reason I couldn't get it to trigger. Basically, on marker click I what to toggle hide and show the "profile-container" class. Any suggestions would be most appreciated.