javascriptjqueryajaxfancybox-2

How can I increase/decrease FancyBox2 popup size after popup display and appending data which is return by an AJAX call


I have an application in which I am displaying a fancybox. After displaying a fancybox I am making an ajax call and that call return some data.

When I append that data into fancybox I am getting scrollbars. I want to resize fancybox whenever any data added/removed in fancybox dynamically. How can I do that?


Solution

  • Thanks You All, finally i have found the solution, just add these replace this line in your fancybox origHeight = body.outerHeight(true); with origHeight = body.height()+10; and add this line too origWidth = body.width()+10;.

    after that just set your height of fancybox to auto and call window.parent.jQuery.fancybox.update() after any append/ remove of your data. Like

    $("a.fancy-view").click(function(){
      var viewID = $(this).attr("id");
      $("#"+viewID).fancybox({
          type: 'iframe',
          'autoSize': false,
          'autoDimensions'        :   false,
          href: $("#"+viewID).attr('href'),
          width:600,
          height:'auto',
          'beforeLoad': function(){
             $.fancybox.showLoading();
           }
        });
     });
    
    $(document).ready(function(){
    $("#append").click(function(){
    $("#mydiv").html(anyhtmldata);
    window.parent.jQuery.fancybox.update();
    });
    });
    

    after done i have found that for what i am looking i got it.