Last active
October 16, 2017 07:20
-
-
Save YeomanYe/828b5ec83d59d5e1ce388b3c929f8038 to your computer and use it in GitHub Desktop.
HTML:font ringWords
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="circular"> | |
circular reasoning works because | |
</div> | |
<script> | |
document.querySelectorAll('.circular').forEach(function(el) { | |
var NS = "http://www.w3.org/2000/svg"; | |
var xlinkNS = "http://www.w3.org/1999/xlink"; | |
var svg = document.createElementNS(NS, "svg"); | |
var circle = document.createElementNS(NS, "path"); | |
var text = document.createElementNS(NS, "text"); | |
var textPath = document.createElementNS(NS, "textPath"); | |
svg.setAttribute("viewBox", "0 0 100 100"); | |
circle.setAttribute("d", "M0,50 a50,50 0 1,1 0,1z"); | |
circle.setAttribute("id", "circle"); | |
textPath.textContent = el.textContent; | |
textPath.setAttributeNS(xlinkNS, "xlink:href", "#circle"); | |
text.appendChild(textPath); | |
svg.appendChild(circle); | |
svg.appendChild(text); | |
el.textContent = ''; | |
el.appendChild(svg); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment