سؤال

index.html file as below: This HTML is compiled with Handlebars

<div id="svg"></div>

index.js file as below:

var s = Snap("#svg");
var bigCircle = s.circle(150, 150, 100);

When i executed my code. It is showing me following error:

TypeError: s.circle is not a function
هل كانت مفيدة؟

المحلول

Your problem is that you are trying to attach Snap to a div element, instead of an SVG element.

Try changing

<div id="svg"></div> 

to

<svg id="svg"></svg> 

You can always put the svg inside a div.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top