https://mynameislau.github.io/image-ratios/
simply import image-ratios
in your main js file (or simply embed it via a <script>
tag).
- If you use the
<script>
method, to start detecting ratios, callimageRatios.startDetecting
- If you import it, you can just call imageRatios()
You can an options object as the function argument :
imagesSelector
: a string representing the selector for images you want to start the detection onratios
: a list of ratios It should be shaped like this :[ { name: '1-1', value: 1 }, { name: '16-9', value: 16 / 9 }, { name: '4-3', value: 4 / 3 } ]