I'm an art photographer in my spare time, and I'm working on a new design for my web site (note: NSFW) using a great open-source slideshow library, JSSOR.
I want to fill the browser without changing the aspect ratio of the photos (i.e., center them as large as possible).
A $FillMode
of 1
works beautifully for this, but I'm having trouble creating code to respond to browser resize/rotation.
Calculating the proper new height/width (browser minus footer text and a little margin) on resize is easy, but there appears to be no way to set the width and height programmatically after the slideshow has initialized. Am I missing something?
All of the responsive code I've seen for JSSOR (e.g., this answer) uses the $ScaleWidth()
method. Unfortunately, that method attempts to maintain the aspect ratio of the slideshow canvas, while I want the slideshow canvas to stretch with the browser (while maintaining the aspect ration of the photo via the $FillMode=1
logic).
I dug into the code for $ScaleWidth()
, but there's some weird DOM-voodoo in there, so I haven't figured out how to create a my own method to force-resize to a particular width and height.
Ideas?
Scripts
html
For anyone who comes looking for $ResizeCanvas. They've finally added a function that can help get the required slider size with $ScaleSize.