Norkart / Leaflet-MiniMap

A minimap control plugin for Leaflet
BSD 2-Clause "Simplified" License
395 stars 125 forks source link

IE8 fallback PNG support #76

Closed seyfro closed 9 years ago

seyfro commented 9 years ago

Hi Robert,

first thanks a lot for the new release - will update my plugin with the next release. As backward compatibility for IE8 is an issue for me, I have searched and found a workaround, so that when the minimap is viewed with IE8, at least the PNG icon and not an empty control is displayed.

old ´´´.leaflet-control-minimap-toggle-display{ background-image: url("images/toggle.svg"); background-size: cover; position: absolute; border-radius: 3px 0px 0px 0px; }´´´

new ´´´.leaflet-control-minimap-toggle-display{ background-image: url("images/toggle.svg"); background-image:url(images/toggle.png)\0; /workaround for IE8/ background-size: cover; position: absolute; border-radius: 3px 0px 0px 0px; }´´´

background infos: http://dimox.net/personal-css-hacks-for-ie6-ie7-ie8/ https://stackoverflow.com/questions/5852681/target-ie9-or-ie8-but-not-both-using-css https://stackoverflow.com/questions/660652/ie8-css-selector

let me know if that would work for you too! best,

Robert

robpvn commented 9 years ago

I don't like those hacks, but upon thinking a bit more about it I realise that Leaflet has the leaflet-oldie CSS class for this kind of thing, so it should work if we implement that. (A CSS selector named .leaflet-oldie .leaflet-control-minimap-toggle-display That would mean making Leaflet 0.7.0 our minimum required version, which shouldn't be so bad considering it's over a year old and rock stable. (And we'd bump our version to 3.0, hurray!)

But I don't have any IE8 to test with, can you help in that department?

robpvn commented 9 years ago

I created a branch for new IE8 support, but it needs some testing. I think it should work fine, and the CSS works correctly when I alter it in Firebug, but someone needs to test it against a real IE8 to make sure it works.

seyfro commented 9 years ago

using leaflet-oldie is better than that dirty hack, good point. Just tested it successfully with IE8. BTW: with IE9 the svg image is used, but the rotation when clicking on it does not work.

robpvn commented 9 years ago

I added the space like you suggested in the commit comment, is it all good now?

seyfro commented 9 years ago

yes, with spaces PNG is shown in IE8

robpvn commented 9 years ago

OK, with the new release 2.1.0 we should have the best of both worlds, SVG for modern browsers and PNG for crotchety old fossils like IE8!

seyfro commented 9 years ago

great, thanks!