1.0.2 • Published 2 years ago

simplyrotate-js v1.0.2

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
2 years ago

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