2012-10-23 140 views
0

我會用兩次不同的結果做兩次相同的事情!
我在這裏建立了一個商店,它工作正常
鏈接到應用程序:https://www.facebook.com/stlocarina/app_365351356883221Facebook iframe應用程序中的滾動條...再次

和代碼鬆動滾動條:

 <div id="fb-root"></div> 
    <script src="https://connect.facebook.net/en_US/all.js"></script> 
    <script> 
    window.fbAsyncInit = function() { 
    FB.init({ 
     appId : '365351356xxxxxx', //Your facebook APP here 
     cookie : true // enable cookies to allow the server to access the session 
    }); 
    } 

    window.onload = function() { 
    FB.Canvas.setAutoGrow(91); 
    } 
</script> 

這裏嘗試相同的代碼後,我已經滾動條。

鏈接到應用程序中的FB:https://www.facebook.com/AshevilleAleTrail/app_420678397982002

下面是我使用的(那不是很合作),以嘗試和自動調整大小代碼:

<div id="fb-root"></div> 
<script type="text/javascript"> 
    window.fbAsyncInit = function() { 
    FB.init({ 
    appId  : '420678397xxxxxx', // App ID 
     channelUrl : '//www.publicityresultshosting.com//channel.html', // Channel File 
    status  : true, // check login status 
    cookie  : true, // enable cookies to allow the server to access the session 
    xfbml  : true // parse XFBML 
    }); 

    }; 

// Load the SDK Asynchronously 
    (function(d){ 
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} 
js = d.createElement('script'); js.id = id; js.async = true; 
js.src = "//connect.facebook.net/en_US/all.js"; 
d.getElementsByTagName('head')[0].appendChild(js); 
    }(document)); 
</script> 


<script type="text/javascript"> 
    window.fbAsyncInit = function() { 
     FB.init({appId: '420678397xxxxxx', status: true, cookie: true, xfbml: true}); 
     FB_RequireFeatures(["CanvasUtil"], function(){ FB.XdComm.Server.init("xd_receiver.htm"); 
      FB.CanvasClient.startTimerToSizeToContent(); }); 
      FB.Canvas.setAutoResize(true,500); 
    }; 
    (function() { 
     var e = document.createElement('script'); e.async = true; 
     e.src = document.location.protocol + 
      '//connect.facebook.net/en_US/all.js'; 
     document.getElementById('fb-root').appendChild(e); 
    }()); 
    </script> 

就如何解決這個任何想法?

+0

rtfm? (setAutoResize已被棄用,不再使用)https://developers.facebook.com/docs/reference/javascript/FB.Canvas.setAutoGrow/ –

回答

2

您必須設置大小,並且在頁面加載後,您可以在回調中運行setAutoGrow()

FB.Canvas.setSize({ width: 810, height: 950 }); 

FB.Canvas.setDoneLoading(function(response) { 
    FB.Canvas.setAutoGrow(); 
});