Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7496727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:45:33+00:00 2026-05-29T18:45:33+00:00

I’m making a responsive site and need to include a Facebook Like-Box for the

  • 0

I’m making a responsive site and need to include a Facebook Like-Box for the client’s Facebook fanpage. The developer page for the like-box has a widget for customization, but it doesn’t allow you to set a width in percentages.

I’ve searched around and the closest I’ve got was this page from 2010, which refers to a fb:fan widget that allows you to link custom CSS. I tried to get this tutorial to work but it fails with this error:

<fb:fan> requires one of the "id" or "name" attributes.

So, to recap, I need a Facebook Like Box that I can either set up to be fluid, or which allows me to pass custom CSS to the iFrame it generates. Anyone able to point me in the right direction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T18:45:35+00:00Added an answer on May 29, 2026 at 6:45 pm

    You thought it couldn’t be done? AHA! Have at you, Facebook and your wicked fixed-width ways: I wrote a JQuery script to undo all your evil!

    $(document).ready(function(){   
        var fbWidth;
    
        function attachFluidLikeBox(){
            // the FBML markup: WIDTH is a placeholder where we'll insert our calculated width
            var fbml = '<fb:like-box href="http://www.facebook.com/YOURFANPAGEORWHATEVS" width="WIDTH" show_faces="false" stream="true"></fb:like-box>';//$('#likeBoxTemplate').text().toString();
    
            // the containing element in which the Likebox resides
            var container = $('#likebox');  
    
            // we should only redraw if the width of the container has changed
            if(fbWidth != container.width()){
                container.empty(); // we remove any previously generated markup
    
                fbWidth = container.width(); // store the width for later comparison
    
                fbml = fbml.split('WIDTH').join(fbWidth.toString());    // insert correct width in pixels
    
                container.html(fbml);   // insert the FBML inside the container
    
                try{
                    FB.XFBML.parse();   // parses all FBML in the DOM.
                }catch(err){
                    // should Facebook's API crap out - wouldn't be the first time
                }
            }
        }
    
        var resizeTimeout;
    
        // Resize event handler
        function onResize(){
            if(resizeTimeout){
                clearTimeout(resizeTimeout);
            }
    
            resizeTimeout = setTimeout(attachFluidLikeBox, 200);    // performance: we don't want to redraw/recalculate as the user is dragging the window
        }
    
        // Resize listener
        $(window).resize(onResize);
    
        // first time we trigger the event manually
        onResize();
    });
    

    What is does is it adds a listener to the window’s resize event. When it resizes, we check the width of the Likebox’ containing element, generates new XFBML code with the correct width, replaces the containing element’s children with said XFBML and then trigger the Facebook API to parse the XFBML again. I added some timeouts and checks to make sure it doesn’t do anything stupid and only runs when it needs to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
In my XML file chapters tag has more chapter tag.i need to display chapters
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.