Specify The Alignment Of Any Element - jQuery ElementPositioning

Specify The Alignment Of Any Element - jQuery ElementPositioning
File Size: 5.66 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

ElementPositioning is a very small jQuery plugin which allows you to specify the horizontal & vertical alignment of any elements within its parent container.

See also:

How to use it:

1. Include the latest version of jQuery library and the jQuery ElementPositioning plugin's script on the html page.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="build/js/elementpositioning.js"></script>

2. Call the function on the target element and pass the alignment argument, this will determine whether an element should be aligned vertically, horizontally or both ways to the parent container.

  • top-center
  • top-left
  • top-right
  • middle-center
  • middle-left
  • middle-right
  • bottom-left
<div class="container">
  <div id="elem">Position this element</div>
</div> 
$("#elem").positionElement({ 
  alignment: 'middle-center' 
});

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