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

  • Home
  • SEARCH
  • 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 6769987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:15:32+00:00 2026-05-26T15:15:32+00:00

I use facebook commenting plugin on my website. It is hidden in a div.

  • 0

I use facebook commenting plugin on my website. It is hidden in a div.

<div style="display: none" id=cmbx(id) class="comentBox">

  <div class="fb-comments" data-href="mywebsite.com(id)" data-num-posts="5" data-width="520"></div>  

</div> 

This is facebook comments javascrip part

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {return;}
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=143512332326919";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

There is a jquery function that shows hidden .comentBox div, it lunches once the following link is clicked

<a class="st_commentsa" href="#" onClick="return false" onMousedown="javascript:toggleSlideBox(\'cmbx(id)\');">Comments</a>

and here is a jQuery function

function toggleSlideBox(x) {
    if ($('#' + x).is(":hidden")) {
        $(".comentBox").slideUp(200);
        $('#' + x).slideDown(200)
    } else {
        $('#' + x).slideUp(200)
    }
}

The problem is as follows. Once a hidden div get’s expanded there is a lot of space under facebook comments that is not suppose to be there, I guess this is caused, because jquery function doesn’t know the height of facebook iframe. Could you please suggest any
solutions / modifications that can fix this problem?

You can see the problem yourself here: http://inelmo.com/inelmo (click on several comments links under the posts to oppen hidden divs.)

NOTE: I tested it in several browsers, FireFox works normaly, the problems are present in chrome, safari and IE, not sure about opera.

  • 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-26T15:15:33+00:00Added an answer on May 26, 2026 at 3:15 pm

    This might be a bit hacky, but it should work. (Unable to test).

    The problem seems to be that your iframe is deciding its height is around 400px more than it needs to be for some reason. This might be a facebook issue.

    What you could do is manually set the height of the iframe to “auto” at pageload.

    $(document).ready(function() {
       $(".fb-comments iframe").css("height", "auto");
    });
    

    I’m unable to test this, but have proof of concept editing DOM in chrome.

    —Edited Code Below—

    $(".fb-comments iframe").css("height", function() {
        $(this).contents().find("body").height();
    });
    

    Hopefully this will resolve the problem by setting the iframe height to the height of its contents. Again, not sure how it will turn out with the above. The auto property doesn’t seem to expand the iframe to match its contents the way a normal html element would.
    Keep the code in the Comment Click event.

    I think this might cause another problem where when the contents of the iframe change (as they’re bound to when someone adds a comment) the iframe won’t expand. So we’re now getting to the stage where you have to constantly monitor the contents of the iframe and apply them to the iframe itself, which seems way too complicated, but I can’t think of a simpler way.

    I did a quick search to see if anyone had a cleverer method of expanding an iframe to match its contents and couldn’t see one. But that seems to be what your real question is now that we’ve looked into it.

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

Sidebar

Related Questions

I want to use facebook comments plugin on my website to allow users to
i want to use facebook's fb:dialog tag to display a simple pop-up form for
I am trying to use FaceBook Registration Plugin (http://developers.facebook.com/docs/plugins/registration/). It already has name field
I'm trying to use Facebook's registration tool for my website. I would like to
I want users to be able to use Facebook Connect on MY website. And
Having used the Facebook commenting plugin on my site, I want to get notified
My goal is to use Facebook Login on a website with as few api
I'm using the webtechnick Facebook plugin to use Facebook authentication in my cakephp application.
I'm trying to use Facebook open graph to customize my send and like display,
I have a few blogs that use Facebook comments. They all use the same

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.