I am using Facebook social plugin for developers on my website. It's not responsive on mobiles and tablets I followed few StackOverflow answers but still not able to solve my issue. I have a content row and and a span6 class in which my widget is placed.
my HTML is like this.
<div class="row content_row">
<div class="span6">
<div class="Facebook">
<h2><a id="about_us">Facebook</a></h2>
<div class="fb-page" data-href="https://www.facebook.com/pages/IFix-And-Repair/242100755854336" data-tabs="timeline" data-width="500" data-height="400px" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/pages/IFix-And-Repair/242100755854336">iFixandRepair - Wellington</blockquote></div></div>
</div>
</div>
i did apply some CSS From other answers but it also failed.
Css:
.fb-page, .fb-page iframe[style], .fb-page span {
min-width: 100% !important;
width: 100% !important;
}
Restrictions
Using CSS3 transform
Set data-adapt-container-width="false"
(or something went wrong under 500px)
This fb-plugin was set to 500x500
<script src="jquery.rwd-fb-plugin.js"></script>
<!--FB-page-plugin part1-->
<div id="fb-root"></div> <script>(function(d, s, id) { ... } </script>
<!--FB-page-plugin part2-->
<div class="fb-page"> ... </div>
$(function(){
$('.fb-page').rwd();
});
Demo: RWD-fb-plugin
You need call fb-page div with new data-width and call function "FB.XFBML.parse();" every time, when is site resized.
So JavaScript can help for this problem:
<div class="row content_row">
<div class="span6">
<div class="Facebook">
<h2><a id="about_us">Facebook</a></h2>
<div class="facebook-wrap">
<div class="fb-page" data-href="https://www.facebook.com/pages/IFix-And-Repair/242100755854336" data-tabs="timeline" data-width="500" data-height="400px" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/pages/IFix-And-Repair/242100755854336">iFixandRepair - Wellington</blockquote></div></div>
</div>
</div>
</div>
</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/sdk.js#xfbml=1&version=v2.2";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
$(function(){
$(window).resize(function(){
$('.facebook-wrap').html('<div class="fb-page" data-href="https://www.facebook.com/pages/IFix-And-Repair/242100755854336" data-width="'+$('.facebook-wrap).width()+'" data-height="400px" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/pages/IFix-And-Repair/242100755854336">iFixandRepair - Wellington</blockquote></div></div>');
FB.XFBML.parse();
});
});
</script>
Related
I'm trying to have 3 x 340px wide boxes (used for holding social media feeds) next to each other. I've got the first 2 lined up perfectly but the 3rd is not lining up.
I'm using a custom html field in wordpress. Code is below:
<div style="width:100%;height:500px;float:center;">
<div style="width:340px;height:500px;float:left;background-color:red;">
<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 = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.11';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-page" data-href="https://www.facebook.com/consciousyouthuk" data-tabs="timeline" data-small-header="true" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="false"><blockquote cite="https://www.facebook.com/consciousyouthuk" class="fb-xfbml-parse-ignore">Conscious Youth C.I.C</blockquote></div></div>
<div style="margin:0 auto;width:340px;height:500px;background-color:red;">
<a class="twitter-timeline" data-width="340" data-height="500" href="https://twitter.com/Cyouthcic?ref_src=twsrc%5Etfw">Tweets by TwitterDev</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script></div>
<div style="width:340px;height:500px;float:right;background-color:red;">
</div>
</div>
Image here shows what it's doing:
Hi you can do this easily by using bootstrap grid. check the jsfiddle output :: https://jsfiddle.net/ruokr7rp/1/
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css">
<div class="container">
<div class="row">
<div class="col-sm" style="background-color:red;">
<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 = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.11';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-page" data-href="https://www.facebook.com/consciousyouthuk" data-tabs="timeline" data-small-header="true" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="false">
<blockquote cite="https://www.facebook.com/consciousyouthuk" class="fb-xfbml-parse-ignore">Conscious Youth C.I.C</blockquote>
</div>
</div>
<div class="col-sm" style="background-color:red;">
<a class="twitter-timeline" data-width="340" data-height="500" href="https://twitter.com/Cyouthcic?ref_src=twsrc%5Etfw">Tweets by TwitterDev</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
<div class="col-sm" style="background-color:red;">
</div>
</div>
</div>
check this :: https://jsfiddle.net/ruokr7rp/
I am trying to build in a facebook feed that disppears when the page get's too thin.
<div id="facebook">
<div id="fb-root" class="col-md-4 col-xs-12" style="margin:0;padding:0;"></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/sdk.js#xfbml=1&version=v2.8";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-page" data-href="https://www.facebook.com/novakovtech/" data-tabs="timeline" data-width="500" data-height="700" data-small-header="false" data-adapt-container-width="false" data-hide-cover="false" data-show-facepile="true">
<blockquote cite="https://www.facebook.com/novakovtech/" class="fb-xfbml-parse-ignore">
Novakov Tech
</blockquote>
</div>
</div>
That was my html
Here is my CSS:
#facebook{
width:40% !important;
float:left!important;
}
#media(max-width:1300px){
#facebook #fb-page #fb_iframe_widget #fb-xfbml-parse-ignore #fb-root{
visibility:hidden !important;
display:none !important;
}
}
I tried to make every class possible have a display none, but nothing worked so far. I am getting frustrated so thank you for any help you can provide.
why not utilize bootstrap classes for this
<div id="facebook" class="hidden-xs hidden-sm">
---
---
</div>
ex: hidden-xs will hide div in xtra small screen (<768px) like mobile
you can learn more here http://getbootstrap.com/css/#responsive-utilities-classes
I use JQuery-Mobile for some components in an ASP.NET MVC 4 application. But I have a display problem.
<body>
<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/fr_FR/sdk.js#xfbml=1&appId=679266642148477&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div data-role="page">
<div data-role="panel" id="userMenu" data-position="left" data-display="push" data-theme="g">
<ul data-role="listview" data-theme="g">
<li id="menuTxt" data-role="list-divider">Menu</li>
<li><a data-ajax="false" href="/Home">Accueil</a></li>
<li><a data-ajax="false" href="/CheckFridge">Mes ingrédients</a></li>
<li><a data-ajax="false" href="/AddRecipe">Ajouter une recette</a></li>
<li><a data-ajax="false" href="#">Déconnexion</a></li>
<li><a data-ajax="false" href="/MyRecipes">Mes recettes</a></li>
<li><a data-ajax="false" data-href="https://developers.facebook.com/docs/plugins/">Partager</a></li>
</ul>
</div>
<div data-role="header">
<a id="menuBtn" href="#userMenu"></a>
<img id="icook_logo" src="~/Content/images/icook_logo.jpg" />
</div>
<div data-role="ui-content">
<a data-role="button" href="#Url.Action("Index", "CheckFridge")" data-theme="c" data-ajax="false" id="checkFridgeBtn">Check mon frigo</a>
<a data-role="button" data-theme="c" id="classicSearch">Recherche classique</a>
</div>
</div>
</body>
Since that I've added a left menu(), all the content is at bottom of my page.
Top of my page :
Bottom of my page :
Can you help me ?
Thank you
The problem is your ui-content div. If you are using jQM version 1.4.x it should be:
<div role="main" class="ui-content">
If you are using 1.3.x:
<div data-role="content">
I am attempting to adjust the width of the Google+ comment widget for the mobile device. Here is my HTML:
<div id="tabs">
<ul>
<li><img src="/images/icon-facebook.png" alt="Facebook Icon" /><p class="tabTitle">Comment on <strong class="fbBlue">Facebook</strong></p></li>
<li><img src="/images/icon-plus.png" alt="Google+ Icon" /><p class="tabTitle">Comment on <strong class="googleRed">Google+</strong></p></li>
</ul>
<div id="tabs-1">
<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=654528351241254";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-comments" data-href="http://www.harvekeronline.com/3dlm-lesson-your-ideal-life/" data-colorscheme="light" data-numposts="10" data-width="100%" data-order-by="reverse_time" data-mobile="200px"></div>
</div>
<div id="tabs-2">
<script src="https://apis.google.com/js/plusone.js">
</script>
**<div class="g-comments"
data-href="http://www.harvekeronline.com/3dlm-lesson-your-ideal-life/"
data-width="medium"
data-first_party_property="BLOGGER"
data-view_type="FILTERED_POSTMOD">
</div>**
</div>
</div>
It is possible that the "tabs" div is messing this up, but other then that, I have no idea.
Does anyone have any suggestions?
I have a facebook Like button in my website.
I have kept the Like Button only once.
When I try it in my local system. I get the Like button correctly But the same index.html when put Live shows me 2 like button .. How do I handle this .
Strange, from looking at the source the problem is:
<div id="callUs" style="FLOAT: right"><a>Call us: +91-95661 60513<br ><span>email: bimmtechnologies#gmail.com</span></a></div>
<div align="right" class="fb-like" data-href="http://bimmtechnologies.com/" data-send="true" data-width="450" data-show-faces="true"></div>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.bimmtechnologies.com/" scrolling="no" frameborder="0" style="border:none; width:200px; height:40px">
</iframe>
there seems to be only one iFrame, yet inspecting DOM gives you:
<div id="callUs" style="float: right;"><a>Call us: +91-95661 60513<br><span>email: bimmtechnologies#gmail.com</span></a></div>
<div class="fb-like fb_edge_widget_with_comment fb_iframe_widget" data-href="http://bimmtechnologies.com/" data-send="true" data-width="450" data-show-faces="true" align="right">
<span style="height: 29px; width: 450px;">
<iframe src="http://www.facebook.com/plugins/like.php?channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D5%23cb%3Df1d310dc178f298%26origin%3Dhttp%253A%252F%252Fwww.bimmtechnologies.com%252Ffd67aabbddb5%26domain%3Dwww.bimmtechnologies.com%26relation%3Dparent.parent&extended_social_context=false&href=http%3A%2F%2Fbimmtechnologies.com%2F&layout=standard&locale=en_US&node_type=link&sdk=joey&send=true&show_faces=true&width=450" class="fb_ltr " title="Like this content on Facebook." style="border: medium none; overflow: hidden; height: 29px; width: 450px;" name="f2e9ee7de90f1f6" id="f7f40995b577b2" scrolling="no"></iframe>
</span>
</div>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.bimmtechnologies.com/" style="border: medium none; width: 200px; height: 40px;" frameborder="0" scrolling="no">
</iframe>
Some strange java-script is adding content into the div with class "fb-like":
<div align="right" class="fb-like" data-href="http://bimmtechnologies.com/" data-send="true" data-width="450" data-show-faces="true">
</div>
If you disable javascript, notice how the double disappears.
Fix
remove the aforementioned div as well as:
<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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
which appears right after
<body>
Double-check your code because you really have two iframes generating fb buttons. You have one div with class .fb-like fb_edge_widget_with_comment fb_iframe_widget (the one that is styled, which makes me think is the right one), and right after you close this div you have another iframe tag that you can try to delete. As a last option, try this in your style.css file: #header > iframe { display: none; } - Hope it helps!