> I am trying build a slide show using the Cycle plugin. > > My (simple) code issues a JSON request (getJSON) to obtain the URLs of a few > images. The images are displayed but the cycle method does not work, ie. all > the images are displayed, no 'cycle' happens. Images are not hosted on the > same machine as the one that replies to the JSON request. > > Am I missing something ?
You need to put the cycle call in your json callback: $.getJSON(url, function(data) { var $images = $('#images').empty(); var html = ''; $.each(data.img, function(i, item) { html += ' ' + item.image + ' ' }); $images.append(html).cycle(); }); At the time you invoke cycle, the slide elements *must* exist in the DOM. It's ok if images haven't been downloaded yet, but the elements must be there otherwise cycle has nothing to work with. Cheers. Mike