(this is related to a previous question of mine)
I am adding a divIcon (an svg) as the icon for features in a geoJSON, using Leaflet.I can add a class to the html property of the icon, but I cannot seem to dynamically add or remove the class using jQuery. I would like to do this to change the size of the icon at different zoom levels (unless anyone else has a better idea how to do this?)
code snippets below:
this part works as expected; the icon is the size given in the css class (although the 'size' property seems to be ignored)
var icon = L.divIcon({"iconSize":new L.Point(50, 50), "iconAnchor": AnchorIcon, "popupAnchor": PopIcon, html: ''});but if I try to dynamically find if this class exists on a zoom event with JQuery, the return value is false:
map.on('zoomend', function(e) { console.log( $('#thisIcon').hasClass("thisIcon15") ); // falseI tried directly referencing 'svg' in the JQuery call as well...no luck.
أكثر...
I am adding a divIcon (an svg) as the icon for features in a geoJSON, using Leaflet.I can add a class to the html property of the icon, but I cannot seem to dynamically add or remove the class using jQuery. I would like to do this to change the size of the icon at different zoom levels (unless anyone else has a better idea how to do this?)
code snippets below:
this part works as expected; the icon is the size given in the css class (although the 'size' property seems to be ignored)
var icon = L.divIcon({"iconSize":new L.Point(50, 50), "iconAnchor": AnchorIcon, "popupAnchor": PopIcon, html: ''});but if I try to dynamically find if this class exists on a zoom event with JQuery, the return value is false:
map.on('zoomend', function(e) { console.log( $('#thisIcon').hasClass("thisIcon15") ); // falseI tried directly referencing 'svg' in the JQuery call as well...no luck.
أكثر...