gre/slider.js — pull request #10 by fixermark (2011-11-25 19:01:50+00:00)
Title: Scaling algorithm to fit images to slider frame

Greetings!

I've been using slider.js for a personal photo spinner project. I thought people might be able to use the modifications I made to support images of heterogeneous sizing; in the original configuration, an image's width is fit to the width of the slider and the height is scaled to maintain aspect ratio (but the bottom of the image might be clipped).

This modification updates the image size relative to the slider frame so that the entire image fits in the frame. More specifically, the image is scaled up or down as needed so that:

* the entire image fits in the frame
* aspect ratio is maintained
* one of the dimensions (width or height, depending on the aspect ratio of the frame and the image) is filled.

-- Known Issues --
* Resizing the slider does not recompute the image sizes.
* slider.min.js has not been updated and the docs have not been updated (I lack a functional install of yuicompressor or doccos).

Let me know if you have any questions!

Sincerely,
Mark Tomczak
Pittsburgh, PA, USA