Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This could be inteteresting for me too so I just fixed the tutorial script:</p> <p><a href="http://jsfiddle.net/5Kme2/" rel="nofollow"><strong>JSFiddle</strong></a></p> <p>Of course you need to import jquery and the viewport plugin (if you want to use it).</p> <pre><code>&lt;script src="jquery.js"&gt;&lt;/script&gt; &lt;script src="jquery.viewport.js"&gt;&lt;/script&gt; </code></pre> <p>Then include fbroot tag only once and give the holders an specific data-url attribute because loading one url multiple times doesn't seem to be possible. Late we will read out this data-attribute.</p> <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt; &lt;div class="facebookHolder" data-url="https://www.facebook.com/Google"&gt;&lt;/div&gt; &lt;p style="height: 500px;"&gt;&lt;/p&gt; &lt;div class="facebookHolder" data-url="https://www.facebook.com/yahoo"&gt;&lt;/div&gt; &lt;p style="height: 500px;"&gt;&lt;/p&gt; &lt;div class="facebookHolder" data-url="https://www.facebook.com/stackoverflowpage"&gt;&lt;/div&gt; </code></pre> <p>Then use the following jQuery code:</p> <pre><code>$(document).ready(function() { jQuery.getScript('http://connect.facebook.net/en_US/all.js#xfbml=1', function() { // initiate like boxed already in viewport as soon as fb sdk loaded. checkScrollingForWidget(); }); function checkScrollingForWidget(event) { $('.facebookHolder:in-viewport').each(function(index, item) { if (!$(item).hasClass('fb_loaded')) { $(item).append('&lt;fb:like-box href="' + $(item).attr('data-url') + '" width="300" show_faces="true" stream="false" header="false"&gt;&lt;/fb:like-box&gt;'); $(item).addClass('fb_loaded'); FB.XFBML.parse(); } }); } $(window).bind('scroll', checkScrollingForWidget); }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload