Skip to content
This repository has been archived by the owner on Apr 27, 2020. It is now read-only.
/ ratio-active Public archive

jQuery plugin that will actively resize an element to fill it's container while keeping it's ratio intact

Notifications You must be signed in to change notification settings

4lun/ratio-active

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ratioactive

Ratioactive is a jQuery plugin that actively resizes an element to fill it's container while keeping it's ratio intact

Usage

Ratioactive works by working out the total available width available to the targeted element, then resizing it based on the element's original ratio.

$('.embed iframe').ratioActive();

Tips & Notes

  • Horizontal padding and/or margins should not be present on the targeted element, use a parent element instead
  • Ratioactive binds to the window resize event, but uses a timeout reset and delay to ennsure it fires at most every 150 ms
  • Binding to a large amount of elements may result in tears (at least with flash)

To Do

  • Add options for whether to listen to resize event and also the ability to bind to a custom event
  • Look into only binding once per element, although function works with mutiple rebinds it's far from ideal

About

jQuery plugin that will actively resize an element to fill it's container while keeping it's ratio intact

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published