Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've been using this method (http://voormedia.com/blog/2012/10/displaying-and-detecting-support-for-s...) for SVG replacement for supported retina devices. I have encountered an issue with the panels IPE's dropdowns not working properly. Basically they would display without a background and all the JS/CSS was working improperly. (see attached).
The problematic code is;
<script>
if (document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1")) {
document.documentElement.className = "svg";
}
</script>
The suggested fix is;
<script>
var $features = new Object();
var $html = document.documentElement;
$features.svg = document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1");
$html.className += ($features.svg) ? " svg" : " no-svg";
</script>
Or to replace images using modernizer:
<script>
$(document).ready(function () {
if (!Modernizr.svg) {
$('img[src$=".svg"]').each(function() {
var $img = $(this);
$img.attr('src', $img.attr('src').replace(/svg$/, 'png'));
});
}
</script>
Comment | File | Size | Author |
---|---|---|---|
Screen shot 2014-01-07 at 10.58.54 AM.png | 44.29 KB | AaronChristian |
Comments
Comment #1
AaronChristian CreditAttribution: AaronChristian commentedComment #2
japerryNo one is going to fix the bug if there isn't an attached patch ;-)