This little plugin centers your element. Just $element.center().
Based primarily on a Stack Overflow answer with a few tweaks of my own.
Add prepackaged dist/jquery.center.js
to your page. There is also a minified version available.
Alternatively you may install the plugin via Bower.
You'll need to have Node, Bower and Grunt installed. After that the following workflow should do the trick:
- sudo npm install
- bower install
- grunt
The last command will run a development server.
jquery.center.js is available under MIT. See LICENSE for more details.