Fancybox 2.1.3 preventing iframe from haivng scrollbars

user1584751 picture user1584751 · Nov 29, 2012 · Viewed 12.3k times · Source

I am using fancybox.js version 2.1.3 to place external content into an iframe. I am doing this by placing the url followed by a div id (e.g. http://somesite.com#about), this seems to work however the problem is I have not found away to stop fancybox from scrolling. preventing scrolling is necessary since i will be placing several div ids on the same external page and then placing them in iframes with fancybox, and i do not want to give the viewer the ability to scroll down within the iframe to view other div ids on this external page.

//fancybox window script
$(document).ready(function() {
    $(".various").fancybox({
        type        :'iframe',
            scrolling   : 'no',
        maxWidth    : 800,
        maxHeight   : 400,
        fitToView   : true,
        width       : '70%',
        height      : '70%',
        autoSize    : false,
        closeClick  : false,
        openEffect  : 'none',
        closeEffect : 'none',
    });
});

Answer

Samuel picture Samuel · Mar 12, 2013

You can disable the scrolling by using a helper as follows:

    iframe : {
        scrolling : 'no'
    }