jQuery - Fancybox: But I don't want scrollbars!

前端 未结 24 1891
醉话见心
醉话见心 2020-12-15 17:37

I am using jQuery Fancybox for a popup registration form here

I would like the form to come up at the size of 450px by 700px but no matter what I set the height and

相关标签:
24条回答
  • 2020-12-15 17:37

    You need to put the iframe option in it's own context eg:

    $(".someclass").fancybox({
        type : 'iframe',
        iframe : {
            scrolling : 'no'
        }
    });
    
    0 讨论(0)
  • 2020-12-15 17:37

    Add iframe: { scrolling : 'no' } as option

    example

    $.fancybox({
    href: 'yourUrl.html',
    width: 800,
    height: 415,
    autoSize: false,
    type : 'iframe',
    iframe: {
    scrolling : 'no',
    preload   : true
    }});
    
    0 讨论(0)
  • 2020-12-15 17:37

    Edit line 197 and 198 of jquery.fancybox.css:

    .fancybox-lock .fancybox-overlay {
        overflow: auto;
        overflow-y: auto;
    }
    
    0 讨论(0)
  • 2020-12-15 17:39

    I had the same problem with fancybox and an iframe, googled for a solution and ended up here. The overflow: hidden did not work for me, however I found out that fancybox allows you to set the option for the iframe scrolling (equivalent to setting "scrolling=no" attribute on the iframe), which fixes the problem in IE7 in a more graceful manner:

    $.fancybox({
        'type'        : 'iframe',
        'scrolling'   : 'no',
    ... and the rest of the parameters.
    
    0 讨论(0)
  • 2020-12-15 17:39

    I had a similar problem, with vertical scrollbars appearing when I set a maxWidth in the Fancybox options.

    To get around the problem I had to set

    .fancybox-inner {
       overflow: hidden !important;
    }
    

    and set a fixed width CSS rule on the Fancybox content rather than specifying a maxWidth in the Fancybox options. If I did the latter, Fancybox's calculated height for the content was slightly too small - probably hinting at why it was putting in scrollbars in the first place.

    0 讨论(0)
  • 2020-12-15 17:39

    This is the only thing that worked for me for both IE and Google Chrome, I think it's mostly because of the .body.scrollHeight stuff, which works in IE best. I put +30 for Firefox ...

    jQuery.fancybox({
      href: href,
      type: "iframe",
      centerOnScroll: 'true',
      scrolling: 'no',
      width: 650,
      'onComplete': function() {
        jQuery('#fancybox-frame').load(function() {
          jQuery('#fancybox-content').height(this.contentWindow.document.body.scrollHeight + 30);
        });
      }
    });
    
    0 讨论(0)
提交回复
热议问题