Skip to content

Simple function that detects SVG support and appends the SVG or the png fallback to the document

Notifications You must be signed in to change notification settings

sachsy/svgload

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svgLoad

Simple function that detects SVG support and appends the SVG or the png fallback to the document

The library loads and injects SVG files inline with support for fallback to a png file in case the browser doesn't support SVG.

##How to use it Add the script to your page or use browserify (highly recommended) and require it. I recomend using npm as your package manager to make your life easier.

svgLoad([{
    target: '.img',
    url: 'test/assets/test',
    callback: function() {
      var hOne = document.querySelector('h1');
      hOne.innerHTML = 'It worked!';
    }
  }])

About

Simple function that detects SVG support and appends the SVG or the png fallback to the document

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 85.5%
  • HTML 14.5%