I am using cycle2, and set it up programmatically in a separate scripts.js file. Up to the point before adding progressive loading, the sliders all work well. I have multiple sliders on the page, so have set this up as follows:
$('.slider').each(function () {
var $this = $(this);
$this.cycle({
fx: 'scrollHorz',
slides: '> a',
sync: true,
progressive: slides,
speed: 'fast',
timeout: 0,
autoHeight: 'container',
next: $this.next('.slider-navigation').find('.next'),
prev: $this.next('.slider-navigation').find('.prev'),
loader: true
});
});
And my HTML markup is, for each slider, as an example:
<div class="slider">
<a href="/">
<img src="example.jpg">
</a>
<script class="other-slides" type="text/cycle">
var slides = [
"<a href=" / "><img src="
another - example.jpg " /></a>",
"<a href=" / "><img src="
another - example.jpg " /></a>",
"<a href=" / "><img src="
another - example.jpg " /></a>"
];
</script>
</div>
However, now when I load the page, my console states: ReferenceError: slides is not defined which makes sense as the cycle init is in script.js and this markup is on another page, but how can I possibly make this work, or is there a better way? Remember there's multiple sliders on the page.
Thanks, R