Fancybox 2 Open Iframe version from code

box86rowh picture box86rowh · Jun 15, 2013 · Viewed 26k times · Source

I see this example : http://jsfiddle.net/STgGM/ on the FancyApps page, but I need to do similar, but with an iframe! When I replace the image path with a URL it does not do anything, no errors or anything.

$.fancybox.open([
{
    href : 'http://fancyapps.com/fancybox/demo/1_b.jpg',
    title : '1st title'
},
{
    href : 'http://fancyapps.com/fancybox/demo/2_b.jpg',
    title : '2nd title'
}    
], {
    padding : 0   
});

How can I modify this code to do show my url in an iframe.

I have also tried this variation:

$.fancybox({
    href: url,
    openEffect: 'none',
    closeEffect: 'none',
    width: 960,
    height: 540
});

Thanks, Jason

Answer

darshanags picture darshanags · Jun 15, 2013

Try using the 'type' option.

Example:

$.fancybox.open({
    padding : 0,
    href:'http://www.gamespot.com',
    type: 'iframe'
});

Fiddle: http://jsfiddle.net/STgGM/1329/

Docs: http://fancyapps.com/fancybox/#docs