Skip to content

loonkwil/jquery.keep-ratio

Repository files navigation

Keep Ratio

Build Status

A jQuery plugin for keeping the aspect ratio

Example usage: http://loonkwil.github.io/jquery.keep-ratio/

Install

Requirements Bower

bower install keep-ratio --save
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
  <div></div>

  <script src="bower_components/jquery/dist/jquery.min.js"></script>
  <!-- For older browsers (http://caniuse.com/#feat=requestanimationframe) -->
  <script src="bower_components/request-animation-frame/rAF.js"></script>
  <script src="bower_components/keep-ratio/dist/jquery.keep-ratio.min.js"></script>
  <script type="text/javascript">
    $(function() {
      $('div').keepRatio({ ratio: 4/3, calculate: 'width' });
    });
  </script>
</body>

How to make your own build

Requirements: NodeJs, Bower, Gulp

  1. bower install
  2. npm install
  3. npm test
  4. gulp dist or just gulp