How do you resize Fancybox at runtime?

后端 未结 18 1845
情深已故
情深已故 2020-11-30 03:22

Does anyone know how to resize the jQuery Fancybox during runtime?

When initializing the fancybox I can do this:

$(\"tag\").fancybox({ \'frameWidth\         


        
18条回答
  •  北海茫月
    2020-11-30 03:53

    My solution was like that (for fancybox 1.3.4):

    find

    $.fancybox.resize = function() {
            if (overlay.is(':visible')) {
                overlay.css('height', $(document).height());
            }
    
    
            $.fancybox.center(true);
        };
    

    and replace with

    $.fancybox.resize = function() {
        if (overlay.is(':visible')) {
            overlay.css('height', $(document).height());
        }
    
        view = _get_viewport();
        var updated_width = view[0];
        if (updated_width > selectedOpts.width) { updated_width = selectedOpts.width; }
    
        $("#fancybox-wrap, #fancybox-content").css("width", updated_width);        
    
        $.fancybox.center(true);
    };
    

提交回复
热议问题