malsup/cycle — Issue #101: Is there a way to know when the pagination is ready?
Author: javiervd
Created: 2012-02-23 17:35:20+00:00
State: open

Hey first of all great plugin, I'm trying to use it with [jCarousel](http://sorgalla.com/jcarousel/) to allow thumbnails in my pagination to scroll horizontally and it's working fine. The problem is that sometimes the jcarousel plugin doesn't initialize because I believe the pagination is not ready yet. My code looks like this:

```javascript
$('.slideshow').cycle({
timeout : 0,
speed : 1000,
pager : '#image-carousel ul',
pagerAnchorBuilder: function(idx, slide) {
return '
';
}
});

$('#image-carousel').jcarousel();
```

Sometimes when the page loads the jcarousel doesn't work, I used `setTimeout` to delay its initialization about 2 seconds and it worked every time so I assume it must be because sometimes the pager is not ready. I can live with the `setTimeout` solution for now but I think there must be a better way to handle this.