you cannot use the CSS approach used by booklets in openlayers, D3 + openlayer basically retrieves data using d3 on the canvas, which is used as an image.
You need to use the openlayer approch: layers + style, you can have similar performance with the "imagevector" layers with open layers.
i edited your jsfiddle in the style of + imagevector:
http://jsfiddle.net/6r8rat8n/5/
var vector = new ol.layer.Image({
source: new ol.source.ImageVector({
source: vectorSource,
style: new ol.style.Style({
fill: new ol.style.Stroke({
color: '#efefef',
width: 1
}),
stroke: new ol.style.Stroke({
color: '#fff',
width: 1
})
})
})
});
// select interaction working on "mousemove"
var selectMouseMove = new ol.interaction.Select({
condition: ol.events.condition.mouseMove,
style: new ol.style.Style({
fill: new ol.style.Stroke({
color: 'red',
width: 1
}),
stroke: new ol.style.Stroke({
color: '#fff',
width: 1
})
})
});
source
share