danielgindi/jquery-backstretch

Select image based on portrait/landscape orientation?

Closed this issue · 1 comments

Hi,
This is a feature request.

It would be nice for there to be a selection algorithm that takes into account if a device is in portrait or landscape orientation instead of just device width. Our use case is we have HD bg photos - 1920 x 1080px which look great at landscape orientation/desktop.

However portrait oriention some photos are not zooming in great, and attempting to tune portrait device bg image orientation with alignX and alignY is not quite enough control over the portrait experience for some of our photos. We would like to make 2 separate images - our existing landscape crop and a custom portrait crop, and switch based on device orientation rather that width, since -- phone portrait width < phone landscape width < ipad portrait width -- it makes width alone not a suitable way to detect orientation.

I know through CSS media queries you can use orientation, but we are loading with this library to make fixed bg + cover work on the ipad as expected (bg stays fixed and zooms based on view port, not content length) so just media queries also does not fully solve our particular use case.

Love the plugin so far though, keep up the good work and thanks!

Supported now :-)