Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just initialize the Hover Caption plugin on your new elements once they're loaded, using the <code>onRenderComplete</code> hook in the Infinite Ajax Scroll plugin..</p> <p>I've set up a JSFiddle and Gist to simulate the Infinite Scroll along with HCaptions to show you what I mean.</p> <p><a href="http://jsfiddle.net/nate/9JGTV/1/" rel="nofollow">http://jsfiddle.net/nate/9JGTV/1/</a></p> <pre><code>$('.hcaption').hcaptions(); var iterator = 0; $.ias({ container : '.listing', item: '.post', pagination: '.navigation', next: '.next-posts a', triggerPageThreshold: 10, // You should not need this! This is purely to make // it possible to view repeated pages on JSFiddle, // since each hcaption requires a unique ID. onLoadItems: function (items) { $(items).each(function (i, item) { $(item).find('.hcaption') .removeAttr('data-target') .attr('data-target', 'tog-' + iterator); $(item).find('.cap-overlay') .removeAttr('id') .attr('id', 'tog-' + iterator); iterator += 1; }); }, // This is the important bit -- // reinitialize hcaptions on the new items. onRenderComplete: function (items) { $(items).find('.hcaption').hcaptions(); }, loader: '&lt;img src="http://placehold.it/100x50/333333/ffffff/&amp;text=LOADING..."/&gt;' }); </code></pre> <p>There are two important things to note:</p> <ul> <li><p>You have to use <code>onRenderComplete</code>, not <code>onLoadItems</code>, or the hcaptions won't work correctly. I suspect that the plugin makes calculations based on the rendered sizes of the items it uses, which means those sizes are wrong if it gets triggered before they're in the DOM.</p></li> <li><p>hcaptions rely on unique <code>id</code>s for every item. That's kind of a weird limitation - it's not the way I would write the plugin, but, whatevs. So you need to make sure that every new item you load has a unique <code>data-target</code> and <code>id</code>. For my example, I had to do some extra manipulating of the new items in the <code>onLoadItems</code> hook to give them unique <code>id</code>s that you shouldn't need to worry about.</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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