I'm trying to add facebook share to a page. My issue is with multiple share buttons, first works well but others aren't shown in the page. A note, first share button is visible but others are in a container with display:none css applied.
I have this code in top of the page (I changed facebook app Id to FacebookAppID):
<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/es_ES/all.js#xfbml=1&appId=FacebookAppID";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
It is each share div in the page:
<div class="fb-share-button" data-href="@url" data-type="button_count" data-width="450"></div>
This issue can be reproduced in IE.
Thanks
The display:none is what is causing the problem
You will need to hide it using opacity, height, and overflow
.fb-share-button { opacity: 0; height: 0px; overflow: hidden; }
and to show it (height can obviously be changed to whatever you like
.showfb.fb-share-button { opacity: 1.0; height: 21px; overflow: visible; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With