javascript - Insert Facebook Like-box into a jQuery modal dialog -


i'm trying use code insert facebook like-box page:

<script src="http://connect.facebook.net/en_us/all.js#xfbml=1"></script><fb:like-box href="http://www.facebook.com/pages/xxxxx/xxxxx" width="285" show_faces="true" stream="false" header="false"></fb:like-box> 

and i'm trying add jquery modal dialog, i'm doing this:

    <script type="text/javascript">     $(document).ready(function() {     $( "#facebook" ).dialog({         autoopen: true,         height: 350,         width: 350,         modal: true      });     });     </script>  <div id="facebook" title="like us"> <script src="http://connect.facebook.net/en_us/all.js#xfbml=1"></script><fb:like-box href="http://www.facebook.com/pages/xxxxx/xxxxx" width="285" show_faces="true" stream="false" header="false"></fb:like-box> </div> 

it doesn't display in dialog, knows what's problem?

thanks,

you need initialize facebook script @ same time modal displayed

$(document).ready(function() {     $("#mymodal").on("show", function() {         (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'));     }); }); 

anytime dismiss , redisplay need reinitialize it. example, if modal has tabs or pagination , facebook used on page 1 , 2.

if(pageid == 1 || pageid == 2) {     fb.xfbml.parse(); 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -