Does the widget work with infinite scroll?

Joakim Stenberg Updated by Joakim Stenberg

Yes it does, but you need to make some small changes to our tags and depending if you are using a v1 or v2 widget.

Widget v2

Script tag

Add the script to the <head> section of the webpage.

For every instance of the widget add the following part with the widget's id and corresponding class name. 

5ca6fbaf-c8ff-4117-9b6e-6801094c3dec

 

Div tag

To implement a widget on a page with infinite scroll, you have to add the div part of the widget as many times as you want it to appear. Please note that you have to change the class name for each instance!

<div class="strossle-widget-1"></div>

<div class="strossle-widget-2"></div>

<div class="strossle-widget-3"></div>

 

For example:


<script>
  window.strossle=window.strossle||function(){(strossle.q=strossle.q||[]).push(arguments)};
  strossle('5ca6fbaf-c8ff-4117-9b6e-6801094c3dec', '.strossle-widget-1');
  strossle('5ca6fbaf-c8ff-4117-9b6e-6801094c3dec', '.strossle-widget-2');
  strossle('5ca6fbaf-c8ff-4117-9b6e-6801094c3dec', '.strossle-widget-3');
</script>
<script async src="https://assets.strossle.com/strossle-widget-sdk/1/strossle-widget-sdk.js"></script>

 

For each of the widget instances, add a div tag with its corresponding class name where you want it to appear.

<div class="strossle-widget-1"></div>

<div class="strossle-widget-2"></div>

<div class="strossle-widget-3"></div>

 

Widget v1

Div tag

When your site loads the next article after the previous one and the url changes automatically ('infinite scroll'), you will need to send the url in our script.

This is done by adding a parameter 'data-spklw-url="..."', where you will have to add the url of the current article. Example:

<div data-spklw-widget="widget-1234567890" data-spklw-url="https://www.bt.dk/danmark/storcenter-i-ombygning"></div>

Script tag

The script tag has to contain an attribute 'data-spklw-automatic-initialization'.

When this attribute has been added, the script will initialize widgets even if the widget div is added after the initial page load. 

Please be sure to load the script tag only once per page.

The script tag should look like this:

<script data-spklw-automatic-initialization src="//widgets.sprinklecontent.com/v2/sprinkle.js" async></script>

How did we do?

How do I add a widget in an iframe or through Ad Manager?

Can I use the widget in WordPress?

Contact