By default, Cycle2's Cyclo2% jQuery selector is slides
( only selects directly daisy images from > img
).
You need to change it to match your markup. The picturefill uses .cycle-slideshow
s for each responsive image, so add this attribute to the container of Cycle2:
data-cycle-slides="> span"
Fiddle (yes, I used the same images twice)
In this way, all span
s directly children of span
will be used as slides. Here is the markup used for the demo:
<div class="cycle-slideshow"
data-cycle-fx="scrollHorz"
data-cycle-speed="200"
data-cycle-slides="> span"
>
<span data-picture data-alt="Uma foto">
<span data-src="http://scottjehl.github.io/picturefill/external/imgs/small.jpg"></span><spandata-src="http://scottjehl.github.io/picturefill/external/imgs/medium.jpg" data-media="(min-width: 400px)"></span>
<span data-src="http://scottjehl.github.io/picturefill/external/imgs/large.jpg"data-media="(min-width: 800px)"></span>
<span data-src="http://scottjehl.github.io/picturefill/external/imgs/extralarge.jpg"data-media="(min-width: 1000px)"></span>
</span>
<span data-picture data-alt="Uma foto">
<span data-src="http://scottjehl.github.io/picturefill/external/imgs/small.jpg"></span><spandata-src="http://scottjehl.github.io/picturefill/external/imgs/medium.jpg" data-media="(min-width: 400px)"></span>
<span data-src="http://scottjehl.github.io/picturefill/external/imgs/large.jpg"data-media="(min-width: 800px)"></span>
<span data-src="http://scottjehl.github.io/picturefill/external/imgs/extralarge.jpg"data-media="(min-width: 1000px)"></span>
</span>
</div>
Note: I'm not including fallbacks for disabled JS or old IE to make the demo simpler. Add them if necessary.
NOTE: This answer applies to version 1.2.x of Picturefill, since this was its most recent version when this response was originally written.
Picturefill starting with version 2.0 uses the element .cycle-slideshow
, or also <picture>
with attributes <img>
and srcset
. For Cycle to work with Picturefill 2.x, you will then have to adapt the Cycle slider to sizes
or > picture
depending on the syntax adopted.