score:0
You might try implementing the following code into your D3.js JavaScript instead of using CSS:
var feature = g.selectAll("path")
.data(collection.features)
.enter().append("path").attr('style','z-index:9999')
.on("mouseover", function() {
d3.select(this).css("fill", "green").css("stroke", "red");
})
.on("mouseout", function() {
d3.select(this).css("fill", "").css("stroke", "");
});
I have found that using the JavaScript to apply styles has been much more efficient and easier to maintain than trying to use CSS to do so, unless you are specifically using classes. In which case, I would use the .classed()
method (https://github.com/mbostock/d3/wiki/Selections#wiki-classed) to manage the adding and removal of classes.
Hope this helps! If not, sorry. :-/
EDIT 1
I edited to include the mouseout functionality. After looking into this more deeply, the Leaflet thing just pulls in new images, not redrawing an SVG, which is what D3.js does. My only guess is that Safari is ignoring the z-index of your path element. This is apparent whenever you right-click on the path area and then select Inspect Element from the dropdown. On Chrome, it will show you the HTML for the path element, but on Safari, it shows you the HTML for the image being pulled in by the Leaflet stuff.
Source: stackoverflow.com
Related Query
- Leaflet + D3 - No mouseover on Safari
- The mouseover event for D3.js does not work in Leaflet
- Capture mouseover in d3 on a leaflet map
- Show data on mouseover of circle
- How do I save/export an SVG file after creating an SVG with D3.js (IE, safari and chrome)?
- Title Attribute not working for an SVG Rect on Safari
- d3.js - mouseover event not working properly on svg group
- d3.js - How can I set the cursor to hand when mouseover these elements on SVG container?
- Unable to get node datum on mouseover in D3 v6
- Achieving animated zoom with d3 and Leaflet
- d3.js change color and size on line graph dot on mouseover
- D3.js - why mouseover and mouse out fired for each child elements?
- D3: When I add a transition, my mouseover stops working... why?
- d3 - trigger mouseover event
- apply several mouseover events to neighboring (connected) nodes
- Multiseries line chart with mouseover tooltip
- Mouseover on SVG circles
- Multiple mouseover events with d3.tip
- NVD3 - line chart NaN on safari using latest versions
- d3.select(this) works on mouseover, but not on function called in mouseover
- D3: finding graph y-coordinate with mouseover
- Using d3 to create a density & value heatmap layer for leaflet
- How do I get a topojson layer to show up in leaflet using d3?
- How to show a tooltip with value when mouseover a svg line graph using d3.js?
- Add region around SVG path for mouseover
- Testing Mouseover event in D3 with Sinon
- SVG circles don't get repositioned when zooming leaflet map
- D3: Get nearest value from ordinal axis on mouseover
- Making a graph inside a leaflet popup using geoJson data
- D3 color change on mouseover using classed("active",true)
More Query from same tag
- How can I update data with javascript d3?
- d3 selectAll and accesing item with index gives different result
- how to make scatterplot on a line chart zooming and panning correspondingly in D3.js
- d3 refactored pie chart animations failing
- Force.drag().on returns undefined
- d3 textwrap to incorporate <b> and <em> tags
- Rotation with transition
- Add custom text below each X-axis date label in d3.js
- How to position one end of a line element dynamically based on date?
- I can't understand how this .csv file is read
- R2D3 as compared to D3.js
- How to move shape background image with the shape in d3
- Unable to get d3.js data.join and key function working when selecting line
- Svg width not display de leftscale in d3.js heatmap /
- NVD3 - How to add arrow heads to the links using angular-nvd3
- How to zoom properly using D3.js?
- Add my Dataset to circle graph
- D3 How to change dataset based on drop down box selection
- Adding additional graphs to NVD3 multiChart, shortens the chart (due to legend) what is the fix?
- How to add an outerglow to a line
- d3 Transition for Bar Graph is Reversed
- How ticksize arguments are defined in d3 js when the orientation is top?
- d3.csv.parseRows and d3.csv output different results
- d3 not being found from plotly
- Crossfilter average group
- Mongo Query: flatten field and split into a new document
- d3 v4 parallel coordinates selection of paths with d3 v4 brushes
- Render D3 graph from a string of JSON instead of a JSON file
- Is there a way to convert a d3 rollup created with two keys to a flat array-of-objects structure?
- dimple js x-axis date issue with bar chart