각 게시물에 페이스 북 코멘트가 추가 된 tumblr 블로그가 있습니다.무한 스크롤 및 페이 스북 코멘트
저는 또한 infiniteScroll도 사용하고 있습니다.
브라우저가 스크롤되고 내용이 스크롤되면 모든 것이 다시 초기화되어야하므로 어떻게 페이스 북의 주석을 다시 초기화해야합니까?
여기에 (내가 FB처럼 상자와 함께 무한 스크롤 있다고) 내 코드와 나는이 문제를 이해하기 위해 관리 연구의 몇 시간 후 무한 스크롤
function initialiseDescriptions(){
$(".description").each(function(){
$(this).click(function(){
//alert();
var postId = $(this).find(".id")[0].value;
$.openDOMWindow({
windowSourceID:'#post-' + postId,
windowPadding:20,
windowBGColor:'#fff',
overlayOpacity: 60,
borderSize:'0',
height:710,
width: 410,
anchoredSelector:'.defaultDOMWindow'
});
return false;
})
});
//Pretty sure I need to reinitialize facebook comments in here but the following code doesn't work
$("<div id='fb-root'></div>'.appendTo("body");
(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_GB/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
}
$(window).load(function() {
initialiseDescriptions();
var $content = $('#content');
if($content.infinitescroll) {
$content.masonry({
itemSelector: '.posts',
//columnWidth: 235,
isAnimated: true
}),
$content.infinitescroll({
navSelector : 'div#pagination',
nextSelector : 'div#pagination div#nextPage a',
itemSelector : '.posts',
loading: {
finishedMsg: '',
img: 'http://static.tumblr.com/dbek3sy/pX1lrx8xv/ajax-loader.gif'
},
bufferPx : 500,
debug : false,
},
// call masonry as a callback.
function(newElements) {
var $newElems = $(newElements);
$newElems.hide();
// ensure that images load before adding to masonry layout
$newElems.imagesLoaded(function(){
$content.masonry('appended',
$newElems, true,
function(){$newElems.fadeIn();}
);
initialiseDescriptions();
});
});
}else{
$content.masonry({
itemSelector: '.posts',
//columnWidth: 235,
isAnimated: true
});
}
});
나는 구문 분석 XML 및 FBML 옵션을 사용하고는
<스크립트 SRC = "http://connect.facebook.net/en_US/all.js#xfbml=1">