내가 페이지 & URL을 제어 할 수 pjax을 사용하고, 그래서 내용 & URL의 일부는 새로 고치지 않고pjax와 페이스 북 플러그인 (PHP)
을 변경하지만 지금은 직면하고있다 문제는 내가 페이지 안에 페이스 북 코멘트 플러그인을 삽입 한 것이고 처음 페이스 북 코멘트 플러그인을 보여줄 때만 작동하지만 일단 페이스 북 코멘트 플러그인 페이지로 다른 페이지의 페이지를 탐색하면 더 이상 작동하지 않는다. , 나는이 페이지를 탐색 할 때마다 '//connect.facebook.net/en_US/all.js#xfbml=1 & appId = xxxxxxxx'를 제거하려고 시도했지만 결과는 여전히 동일합니다. 이 문제를 해결하도록 도와주세요. 많은 감사.
내 코드는 다음과 같습니다 : -
//의 index.php의 일부
<div id="wrapper">
<div id="content">
<div id="navigation">
<div id="timer">1</div>
<ul>
<li>
<a href="/html5/sample3/finished/index.php" title="You Get What You Give">
You Get What You Give
</a>
<a href="/html5/sample3/finished/index.php?page=fortune-faded" title="Fortune Faded">
Fortune Faded
</a>
<a href="/html5/sample3/finished/index.php?page=liar" title="Liar">
Liar
</a>
<a href="/html5/sample3/finished/index.php?page=universal" title="Universal">
Universal
</a>
</li>
</ul>
</div>
<div id="container">
<div id="left">
<?php echo $content['left']; ?>
</div>
<div id="right">
<?php echo $content['right']; ?>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<script src="js/jquery-1.7.1.min.js"></script>
<script src="js/core.js"></script>
//part of core.js
var systemObject = {
run : function() {
this.content($('#navigation ul li a'));
this.pop();
},
content : function(obj) {
obj.live('click', function(e) {
var thisUrl = $(this).attr('href');
var thisTitle = $(this).attr('title');
systemObject.load(thisUrl);
window.history.pushState(null, thisTitle, thisUrl);
e.preventDefault();
});
},
pop : function() {
window.onpopstate = function() {
systemObject.load(location.pathname);
};
},
load : function(url) {
$("#facebook-jssdk").remove(); //delete //connect.facebook.net/en_US/all.js#xfbml=1&appId=xxxxxxxxx
url = url === '/' ? '/ygwyg' : url;
jQuery.getJSON(url, { ajax : 1 }, function(data) { //load content
jQuery.each(data, function(k, v) {
$('#' + k + ' section').fadeOut(200, function() {
$(this).replaceWith($(v).hide().fadeIn(200));
});
});
});
},
};
$(function() {
systemObject.run();
});
//part of index.php?page=fortune-faded
<section>
<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=xxxxxxxxx";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-comments" data-href="http://example.com" data-num-posts="2" data-width="470"></div>
</section>