5

I'm trying to resize the width of fancybox (v1.3), but I don't know how to do this. The width should change after I receive dynamic content with a jQuery ajax request. The height is resized automatically. Can someone help me with this?

<!-- Fetch action lines of an action  -->
<script type="text/javascript">

    $('#actionType').change(function() {

        var actionTypeId = $(this).children(":selected").attr("id");

        $.ajax({
            type: "POST",
            cache: false,
            url: "/ajax/actionLines.php",
            data: {actionTypeId: actionTypeId},
            success: function(data) {
                $("#actionBlock").html(data);
            }
        });
    });
</script> 
Ben
  • 51
  • 2
  • try using the method `$.fancybox.resize()` (v1.3.x) after the change (try inside the `success` callback) took place. Just bear in mind that the new content should have its own dimensions – JFK Jun 28 '13 at 17:27
  • In addition to @JFK's comment, see [this](http://stackoverflow.com/questions/994876/how-do-you-resize-fancybox-at-runtime) link – Mark Erasmus Aug 28 '13 at 16:09

1 Answers1

2

You must call the update function after putting in the content.

$.fancybox.update();
geeky_monster
  • 8,672
  • 18
  • 55
  • 86