jQuery(document).ready(function($) {
// set width and height of svg
var svgDim = 400;
// get container element
var circles = $("#svgCircles").css({
width: svgDim + "px",
height: svgDim + "px",
marginLeft: -(svgDim / 2) + "px",
marginTop: -(svgDim / 2) + "px",
position: 'fixed',
top: '50%',
left: '50%'
});
// calculate svg center position
var center = svgDim / 2;
var circle;
// generate svg element
var svg = $('<svg width="' + svgDim + '" height="' + svgDim + '"></svg>');
// generate circles
for (var i = 1; i < 11; i++) {
//set element grow rate
var el = i * 15;
circle = $('<g><circle class="circle circle-' + el + '" cx="' + center + '" cy="' + center + '" r="' + el + '" stroke="#CDDC39" stroke-width="7" fill="transparent"></circle></g>');
svg.append(circle);
}
// append circles inside parent container
circles.append(svg);
//svg's are attached to DOM but will not be fisible without a refresh
$("#svgCircles").html($("#svgCircles").html());
})
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.