smares smares - 6 months ago 105
Javascript Question

Opening a fancyBox with a certain aspect ratio

Does anyone know how I can open a resizable fancyBox with a certain aspect ratio (for example 16:9)?

Answer

There isn't a native way of easily resizing Fancybox. You can do some simple math with screen.height to open a Fancybox in a particular aspect ratio relative to the current screen resolution.

var height = screen.height/4;

$("#test").fancybox({
           'width' : 16/9. * height,
           'height' : height,
           'autoDimensions' : false
      }); 
});