jQuery Plugin To Maintain Element Aspect Ratios maintainratio - Download jQuery Plugin To Maintain Element Aspect Ratios - maintainratio

Download jQuery Plugin To Maintain Element Aspect Ratios – maintainratio

Posted on

This time I will share jQuery Plugin and tutorial about jQuery Plugin To Maintain Element Aspect Ratios – maintainratio, hope it will help you in programming stack.

jQuery Plugin To Maintain Element Aspect Ratios maintainratio - Download jQuery Plugin To Maintain Element Aspect Ratios - maintainratio
File Size: 3.85 KB
Views Total: 737
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

maintainratio is a lightweight jQuery plugin which can be used to maintain the aspect ratio of an element (e.g. div) as the window resizes.

How to use it:

1. Link to jQuery library and the jQuery maintainratio plugin.

1 <script src="//code.jquery.com/jquery.min.js"></script>
2 <script src="jquery.maintainratio.js"></script>

2. Call the function on the target element and specify the aspect ratio you prefer.

1 $('.div').maintainRatio({
2   ratio: 1
3 });

3. Set an offset in pixels to the element.

1 $('.div').maintainRatio({
2   ratio: 1,
3   pixelmod: 0
4 });

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

source : jqueryscript.net