I am having trouble using JS to forcefully open the Popup/Info Window for a specific marker when I hover over an associate div.
Please reference apartmentlist.com/ca/san-francisco for an example of what I am attempting: the user hovers over a div (e.g., a rental listing) and then the associated Mapbox map marker changes color and opens a Popup/Info Window. Note the image below in which the mouse is hovering over the div on the left:
Below is my current code. It successfully changes the marker color, but I am not sure how to open the popup.
Initialization, GeoJSON Definition, and Function
<script>
L.mapbox.accessToken = 'apiKey';
var map = L.mapbox.map('map')
.setView([37.8, -122.4], 13)
.addLayer(L.mapbox.tileLayer('mapbox.streets'));
var myLayer = L.mapbox.featureLayer().addTo(map);
myLayer.setGeoJSON(geojson);
myLayer.on('layeradd', function(e) {
var marker = e.layer;
var feature = marker.feature;
var content = 'This is Point ID: ' + feature.properties.id;
marker.bindPopup(content, {
closeButton: false
});
});
myLayer.on('mouseover', function(e) {
var id = e.layer.feature.properties.id;
$('div').removeClass('hover');
$('div[data-rid="' + id + '"]').addClass('hover');
// Open Popup on marker hover
e.layer.openPopup();
});
myLayer.on('click', function(e) {
// Open Popup on marker click
e.layer.openPopup();
});
$('div').hover(function(e) {
var id = $(this).data('id');
// Iterate through GeoJSON until properties.id is found
for (var i = 0; i < geojson.features.length; i++) {
if(geojson.features[i].properties.id == id) {
// If id matches, open popup
// TODO: not working, likely conflict with setGeoJSON() below
}
}
// Update map layer with new geoJSON
myLayer.setGeoJSON(geojson);
})
</script>

$("#abcxyz").mouseover();did you try doing so? This should pop out the div you'd want to see. - Sina