I decided that the best way to handle this was to have these widescreen photos be scrollable somehow. I tried out scripts like panoramaviewer.js and jquery.panr as well as a few others but none of them were exactly what I was looking for. So after a little bit of light reading I decided to create my own jQuery UI Plugin.
Introducing the jQuery UI Photoboxr Plugin...
This plugin creates a constant ratio (4:3) box around a photo. It determines whether the photo is landscape or portrait and lets you scroll it accordingly if its dimensions exceed the size of it's wrapping DIV.
There are overlay indicators for scroll direction which also double up as on/off toggles for scrolling. There is integration for Fancybox to create galleries and photo pop ups too.
Using it is easy. All you need to start is an DIV element with a size defined. This will be the container for any images added by the plugin.
HTML
<div id="photoboxr-container" style="width: 100%;">
</div>
Then the JavaScript is similar to any other jQuery UI plugin, simply call the .photoboxr() method to initialise it. I create an Image object but it could be done on an <img> element too. After the plugin is initialised, the 'wrapper' method is used to fetch the wrapping DIV around the image, which can then be added to the container.
JavaScript
var container = $('#photoboxr-container');
$(new Image()).photoboxr({
src: 'fog_panorama.jpg',
wrapSizingClass: 'ui-pbxr-half'
})
.photoboxr('wrapper')
.appendTo(container);
There are other options available that can be passed to the plugin, these are documented on GitHub.
This plugin works well for me, it's not as versatile as some of the other panoramic view plugins out there, but that was not the point of it. There are some minor issues with it still that I will address over time so keep an eye out for future updates.
-i