How do you resize Fancybox at runtime?

后端 未结 18 1899
情深已故
情深已故 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条回答
  •  猫巷女王i
    2020-11-30 03:49

    Hey after fighting almost two days, I managed to change overlay height. Hope this can be helpful :

    $('#register-link a').fancybox({
        onComplete: function(){
            body_height = $('body').height();
            fancybox_content_height = $('#fancybox-content').height();
            fancybox_overlay_height = fancybox_content_height + 350;
            if(body_height < fancybox_overlay_height ) {
                $('#fancybox-overlay').css('height', fancybox_overlay_height+'px');
            }
        }
    });
    

    What this code doing is, it first calculate height of body, #fancybox-content and #fancybox-overlay. Then it check whether body's height is less than overlay's height, if yes then it assign new calculated height to overlay otherwise it take default body's height

提交回复
热议问题