Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Tips on SVG replace using Modernizr?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40285
    Andy Howells
    Participant

    Hi all,

    I’m currently delving into the wild west of SVG images within my HTML and CSS.

    I have PNG fallbacks for each, but what I want to see is if I can use modernizr to find and replace .svg with .png

    So for example, do;


    $(document).ready(function() {
    $(function()
    {
    if (!Modernizr.svg) {
    //something here //
    }
    });
    });

    What I would like is to simply grab the .svg ending and switch it out for .png if SVG isn’t supported, but I’m useless at JS.

    The images themselves are inside simple img tags.

    Re: the CSS swap, I’m probs going to make an IE style sheet with all the PNG’s instead, but are there any shortcut methods you guys use for this?

    #111819
    chrisburton
    Participant
    #111880
    chrisburton
    Participant

    @andy_unleash Right. I don’t see why you would want to go that route. IE9+ supports SVG with `` tag. When it comes to those who don’t support it, you can change out the extension to png. Doing it your way, I assume, would cause more http requests to grab those SVG images.

    #111889
    chrisburton
    Participant

    @andy_unleash Take a look at this http://code.google.com/p/svgweb/

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.