example-simple.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8"/>
  5. <title>SVGInject Simple Example</title>
  6. <!-- Include the SvgInject javascript file -->
  7. <script src="svg-inject.js"></script>
  8. <script>
  9. SVGInject.setOptions({
  10. onFail: function(img, status) {
  11. console.info(status);
  12. }
  13. });
  14. </script>
  15. <style>
  16. /* Apply colors to injected SVG with id #businesspeople-variation */
  17. #businesspeople-variation-1 .color-1 { color: #68C4B5; }
  18. #businesspeople-variation-1 .color-2 { color: #FBCA61; }
  19. #businesspeople-variation-1 .color-3 { color: #DD7378; }
  20. #businesspeople-variation-1 .color-4 { color: #8B959D; }
  21. #businesspeople-variation-2 .color-1 { color: #607D8B; }
  22. #businesspeople-variation-2 .color-2 { color: #EC407A; }
  23. #businesspeople-variation-2 .color-3 { color: #C2185B; }
  24. #businesspeople-variation-2 .color-4 { color: #90A4AE; }
  25. /* class to define an image size of 128px */
  26. .size-128 {
  27. width: 128px;
  28. height: 128px;
  29. }
  30. </style>
  31. </head>
  32. <body>
  33. <h1>SVGInject Simple Example</h1>
  34. <h3>Not inject SVG:</h3>
  35. <!-- Insert not styled SVG image -->
  36. <img src="svgs/businesspeople.svg" class="size-128" />
  37. <h3>Injected SVG with no style (default SVG colors):</h3>
  38. <!-- Insert not styled SVG image -->
  39. <img src="svgs/businesspeople.svg" onload="SVGInject(this)" class="size-128" />
  40. <h3>Injected SVGs styled with CSS in two different color schemes:</h3>
  41. <!-- Insert the same SVG image styled with CSS in two different color schemes -->
  42. <img src="svgs/businesspeople.svg" onload="SVGInject(this)" class="size-128" id="businesspeople-variation-1" />
  43. <img src="svgs/businesspeople.svg" onload="SVGInject(this)" class="size-128" id="businesspeople-variation-2" />
  44. </body>
  45. <!-- Don't worry about this script. It's used to provide feedback if the example is not running correctly. -->
  46. <script src="_example_helpers/xhr-check.js"></script>
  47. </html>