2012-02-06 51 views
2

我禁用了我的Facebook應用程序(FF9)中的水平滾動條。Facebook中的水平禁用滾動條使用Firefox的畫布

我已閱讀每篇文章或博客中有關此類問題的每篇文章。到目前爲止,我已經使用setAutoGrow並在bodyhtml上應用overflow: hidden

我怎樣才能解決這個問題?

謝謝!

+1

請保持最低限度的咆哮。 – meagar 2012-02-06 17:22:51

回答

0

問題出在https://connect.facebook.net/en_US/all.js。這個問題已被無數次報告爲一個錯誤,但從未被Facebook確認過(見this bug report)。

此代碼同時也適用於all.js錯誤處理安全連接。

請注意,該代碼需要http://jquery.com/才能正常工作。

關於滾動條

訣竅是異步加載all.js DOM已經完全加載之後。然後查找fbAsyncInit回調並繼續setAutoGrow

您還提到了固定寬度(520px)和overflow(-x): hidden。這是一個好主意,但不是必要的。請注意,如果您決定採用這種方式,請在body元素上應用固定寬度,而不是使用某些內部包裝元素。

請參閱下面的代碼和附註。

$(function(){ 
    window.fbAsyncInit = function() 
    { 
     // fixes the HTTPS issue 
     // _https: (window.name.indexOf('_fb_https') > -1), 
     // @version /*1328456404,169895806,JIT Construction: v505175,en_US*/ 
     FB._https   = true; 

     // fix for all.js 
     // the following line enforces using non-secure URL (why Facebook?) 
     // FB.getDomain((c?'https_':'')+'staticfb',true) 
     // @version /*1328456404,169895806,JIT Construction: v505175,en_US*/ 

     FB._domain.api  = 'https://api-read.facebook.com/'; 
     FB._domain.cdn  = 'https://s-static.ak.fbcdn.net/'; 
     FB._domain.staticfb = 'https://s-static.ak.facebook.com/'; 
     FB._domain.www  = 'https://www.facebook.com/'; 
     FB._domain.m  = 'https://m.facebook.com/'; 

     FB.init({appId: [app id], channelUrl: '[domain]/channel.php', status: true, cookie: true, oauth: true, xfbml: true}); 

     FB.Canvas.setAutoGrow(91); 
     // it is good idea to ensure that page will always open top-most view when navigated internally 
     FB.Canvas.scrollTo(0,0); 
    }; 

    // Load the SDK Asynchronously after the DOM is loaded 
    (function(d){ 
     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} 
     js = d.createElement('script'); js.id = id; js.async = true; 
     js.src = "https://connect.facebook.net/en_US/all.js"; 

     d.getElementsByTagName('head')[0].appendChild(js); 
    }(document)); 
});