i'm using jquery load content lightbox-like div in web app i'm working on. using $post, i'm calling dynamically populated page holds youtube video , facebook comment plugin.
the first video load comes comments, each video after comes itself, sans-comments. quick ideas might happening?
this page i'm loading.
<? $video_id = $_post['video_id']; ?> <object width="800" height="499"> <param name="movie" value="http://www.youtube.com/v/<? echo $video_id; ?>?modestbranding=1&version=3&hl=en_us&rel=0"></param> <param name="allowfullscreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/<? echo $video_id; ?>?modestbranding=1&version=3&hl=en_us&rel=0" type="application/x-shockwave-flash" width="800" height="499" allowscriptaccess="always" allowfullscreen="true"></embed> </object> <h5 style="margin:35px 0 8px 0;">comment on video</h2> <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=158242874284543"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-comments" data-href="http://xxxxxxxxxxxx.com/viewvideo.php?video_id=<? echo $video_id; ?>" data-num-posts="12" data-width="800"></div> and call brings in (#view_video div holds lightbox, .video_wrapper div displays info loaded. each thumbnail in div videothumb class, whos id set youtube videos unique id):
<script> //view video $('.videothumb').click(function() { $('#view_video').fadein('fast'); this_video_id = $(this).attr('id'); $.post( 'viewvideo.php', { video_id: this_video_id }, function( data ) { //on complete $('.video_wrapper').html(data); } ); }); </script> thanks!!!
when load first page, facebook js sdk get’s loaded well, , parses xfbml tags in document.
the next time ajax-load page document, js sdk embeded document, nothing further happens – , includes no new parsing of xfbml tags.
you have use fb.xfbml.parse tell sdk should again search document (dynamically added) xfbml tags. (preferable give dom node first parameter, not search whole document again, part dynamic changes have occured.)
Comments
Post a Comment