Responsive width Facebook Page Plugin

前端 未结 17 1877
温柔的废话
温柔的废话 2020-12-02 16:28

Facebook introduced a new Page Plugin to replace the Like box plugin.

Documentation: https://developers.facebook.com/docs/plugins/page-plugin/

I\'m replacing

17条回答
  •  -上瘾入骨i
    2020-12-02 17:24

    for those of you looking for a JS solution to sizes smaller than 280

    here is my code snippit:

    facebookScale = function () {
        var adjustWidth;
        adjustWidth = $('.facebook-likebox').width() / 280;
        return $('.fb-page').css({
          '-webkit-transform': 'scale(' + adjustWidth + ')',
          '-moz-transform': 'scale(' + adjustWidth + ')',
          'transform': 'scale(' + adjustWidth + ')'
        });
      }
    
    $(function(){
        $('.fb-page').on('resize DOMSubtreeModified', facebookScale);
        $(window).on('resize', facebookScale);
      })
    

    edit. make sure the following is in the css:

    .fb-page{
      transform-origin: 0 0;
      -webkit-transform-origin: 0px 0px;
      -moz-transform-origin: 0px 0px;
    }
    

提交回复
热议问题