Can't load Facebook comments when loading content dynamically using Ajax/jQuery -
i having issues getting facebook comments load after adding them webpage using ajax.
javascript code:
$().ready(function() { $(document).delegate(".image a", "click", function() { $("#dynamic-image").load($(this).attr("href"), {ajaxload:1}, function() { $("#dynamic-image").css("display","block"); $('#dynamic-image').lightbox_me({ zindex: 999, centered: false, modalcss: {top: '10px'}, overlaycss: {background: 'black', opacity: .9}, onload: function() { $("#dynamic-image").css("display","block"); fb.xfbml.parse(document.getelementbyid('ajax-fb-comments')); }, onclose: function() { $("#dynamic-image").css("display","none"); } }); }); homecoming false; }); });
html5 facebook comments code:
<div class="fb-comments" data-href="<? echo the_permalink(); ?>" data-width="627" data-num-posts="10" data-colorscheme="light" id="ajax-fb-comments"></div>
i have tried using both xfbml , html5 facebook comment code , neither worked. have used fb.xfbml.parse() before, have working fine dynamically loaded buttons having issues facebook comments, don't load , there no javascript errors.
i got work.
all had utilize "fb.xfbml.parse()" , target div around fb comment tags.
jquery ajax facebook facebook-comments xfbml
No comments:
Post a Comment