The jQuery "scale" plugin resizes objects to fit inside thier parents while maintaining the aspect ratio. It was written for the TouchScreen project which is being developed at the OSU Open Source Lab.
In the examples below, the green box represents the parent, and the red-bordered image represents the object.
Note: As mentioned below, this plugin DOES NOT work in Internet Explorer.
To use the plugin, simply apply the it to any object, i.e.
Optionally, one may also apply the "center" option, which will center the object horizontally and vertically inside the parent, i.e.
One may also apply the "stretch" option, which will stretch the object to fit inside the parent if the object is smaller than the parent, i.e.
One may also combine these options in any order:
This plugin is known to not work correctly in the following browsers:
In each category, the demo shows what the parent/object combination looks like before (on the left) and after applying the plugin (on the right). Please note that the "center" and "stretch" options are enabled for each demo.
don't do anything
|
|
scale the object proportionally to the height of the parent
|
|
scale the object proportionally to the width of the parent
|
|
Scale the object proportionally to the width of the parent
|
|
scale the object proportionally to the height of the parent
|
|
scale the object proportionally to the width
|
|
Scale the object proportionally to the height of the parent
|
|
scale the object proportionally to the width of the parent
|
|
scale the object proportionally to the height
|
|