simplyrotate-js
v1.0.2
Published
A package to make it simple to open rotate html elements.
Downloads
1
Maintainers
Readme
simplyrotate-js
Package to rotate elements with js
Attribution to this post on stackoverflow for pointing out how to go about this. Figured that this is a feature that many people just need a one stop solution for (particularly myself included). So here this is for when I or anyone might need it later.
Usage:
HTML
<span class="rotatible"></span>
JavaScript
import { makeRotatable } from 'simplyrotate-js'
//get all elements classed rotatible
var rotatibleArr = document.querySelectorAll('.rotatible')
//for each of these called makeRotatable on them
rotatibleArr.forEach((r) => makeRotatable(r as HTMLElement))
and there you go...
It should just rotate on drag about the edges of your element