jQuery Plugin For Vertical and Horizontal Center Alignment - Center Me

File Size: 9.3 KB
Views Total: 1076
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin For Vertical and Horizontal Center Alignment - Center Me

Center Me is a very small jQuery plugin that vertically and horizontal centers any element to make it always stay in the center of the page, even when you resize the browser window.

How to use it:

1. Load jQuery library and the jQuery center me plugin.

<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="center-me.js"></script>

2. Call the plugin on an element that will always stay centered.

$('.box').center();

3. Disable the plugin if the screen size is smaller than 320px:

$('.box').center('320');

This awesome jQuery plugin is developed by LeoCreer. For more Advanced Usages, please check the demo page or visit the official website.