Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

interactive svg javascript

<svg viewBox="0 0 100 100">
  
  <circle cx="50" cy="50" r="50" />
  
  <script>
    document.querySelector('circle').addEventListener('click', e => {
      e.target.style.fill = "red";
    });
  </script>
  
</svg>
Source by css-tricks.com #
 
PREVIOUS NEXT
Tagged: #interactive #svg #javascript
ADD COMMENT
Topic
Name
7+7 =