Tin Can
Tin Can

Reputation: 2870

Facebook and Google Directions resize

I'm trying to dynamically resize the facebook iFrame based on the length of the directions provided by the google maps api. So far, no luck.

I'm setting up the async resize in javascript

window.fbAsyncInit = function () { FB.canvas.setAutoResize(); }

and the google maps directions panel is set up like this

directionsService.route( request, function (response, status) {
$('#directions_panel').setDirections(response); }

When I debug, the height of the directions panel (from jQuery's .height) has the value 0.

Upvotes: 0

Views: 130

Answers (1)

Tin Can
Tin Can

Reputation: 2870

I ended up solving it like this:

FB.Event.subscribe('xfbml.render', function (response) {
    FB.Canvas.setAutoResize();
});

Upvotes: 1

Related Questions