Call JavaScript function inside SVG from Surrounding HTML

前端 未结 1 1047
走了就别回头了
走了就别回头了 2020-12-19 00:48

I\'ve created a little page just as this one here:



  
     Test
     

        
1条回答
  •  天命终不由人
    2020-12-19 01:10

    Without seeing the source of your .svg, it's impossible to answer specifically...

    Check this out: https://codepen.io/lambdacreatives/pen/uygzk

    HTML

    
      
        
    
        
            
    
        
      
    
    

    CSS

    body {
      background-color: black;
      text-align: center;
    }
    
    svg {
      height: 100%;
      width: 200px;
      path {
        fill: white;
      }
    }
    

    JS

    $( "#trigger" ).click(function() {
      document.getElementById("ani-circle").beginElement();
    });
    

    If you can't work it out from that, post the source of your .svg and I'll knock up a specific answer for you.

    0 讨论(0)
提交回复
热议问题