Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<script>
function loadAPI() {
var js = document.createElement('script');
js.src = '//connect.facebook.net/zh_TW/sdk.js#xfbml=1&appId=YOUR_APP_ID&version=v3.2';
document.body.appendChild(js);
}
window.onscroll = function () {
var rect = document.getElementById('comments').getBoundingClientRect();
if (rect.top < window.innerHeight) {
loadAPI();
window.onscroll = null;
}
}
</script>
<div id="fb-root"></div>
<div id="comments" class="fb-comments" data-width="100%" data-href="<?php the_permalink() ?>" data-numposts="10" data-colorscheme="light"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment