更新问题:
我们有一个Facebook共享功能,它出现在页面上,也出现在FancyBox中。
桌面:它适用于页面和FancyBox。
移动:当在页面上时,它会打开一个无法使用的FB弹出窗口 - 例如它有"登录facebook"文字,但没有可点击的按钮。在一个花哨的盒子上(即已经有一个弹出窗口),点击共享链接什么也不做。
提前感谢您的想法和帮助。
<?php if ($this->is_facebook && $this->oauth_fb_key) { ?>
<meta property="fb:app_id" content="<?php echo $this->oauth_fb_key; ?>"/>
<meta property="og:site_name" content="<?php echo $this->site_name; ?>"/>
<meta property="og:url" content="<?php echo $this->item['url']; ?>"/>
<meta property="og:title" content="<?php echo $this->item['title']; ?>"/>
<meta property="og:description" content="<?php echo $this->item['description']; ?>"/>
<meta property="og:image" content="https:<?php echo $this->item['image']; ?>"/>
<?php if ($this->og_namespace) { ?>
<meta property="og:type" content="<?php echo $this->og_namespace; ?>:<?php echo $this->og_recipe; ?>"/>
<?php } else { ?>
<meta property="og:type" content="website"/>
<?php } ?>
<?php } ?>
<?php if ($this->oauth_fb_key) { ?>
<script type="text/javascript">
var loaded_fb = loaded_fb || false;
head.ready('jquery', function() {
$(document).ready(function() {
jQuery.ajax({
type: "POST",
url: 'https://graph.facebook.com',
data: { id: '<?php echo $this->item['url']; ?>', scrape: true },
success: function(result) { console.log(result); },
async: false
});
var li = $('.facebook-share-button');
button = $('<li class="facebook-share-button"><div class="fb-like" data-href="<?php echo $this->item['url']; ?>" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div></li>');
if (li.size()) {
li.remove();
}
button.prependTo('.event-load-buttons');
if (!loaded_fb) {
window.fbAsyncInit = function() {
FB.init({
appId: '<?php echo $this->oauth_fb_key; ?>',
status: true,
cookie: true,
xfbml: true
});
};
// Load the SDK asynchronously
(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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
loaded_fb = true;
} else {
var interval = setInterval(function() {
if (typeof FB !== 'undefined') {
FB.XFBML.parse();
clearInterval(interval);
}
}, 20);
}
});
});
</script>
<?php } ?>