title: Jquery Cycle plugin - Great problem with Ajax images loading
body: <p>I've got a problem with the Jquery Cycle pluging.</p>
  
  <p>I load dinamically via Ajax the images of the gallery.</p>
  
  <p>When I click the buttons next or prev of the gallery, the sequence doesn't work correctly.</p>
  
  <p>Sometimes the class activeSlide doesn't change element or an element of the gallery is missed.</p>
  
  <p>If i refresh the page it work correctly.</p>
  
  <p>When i make the ajax call and I change the images inside the gallery I destroy the plugin before and after I redeclare it.</p>
  
  <p>IF I set timeout for the autosliding allworks correctly.</p>
  
  <p>I post the code.</p>
  
  <p>Someone can help me? It's 3 days I try to find a solution :(((((((</p>
  
  <p>Thank you Davide. </p>
  
  <p>This is my code:</p>
  
  <pre><code>success: function(data){
  
      $('#imgcaption').cycle('destroy');//Before load data I destroy the gallery
  
      $('#dettaglio #imgcaption').empty();//I clean the div's
      $('#dettaglio #nav').empty();
  
              //I insert the new Images
              $.each(data.foto, function(index, value){
              $('#imgcaption').append('&lt;div&gt;&lt;img src="' + value + '" alt="" /&gt;&lt;/div&gt;');           
      });
  
              //I redeclare the Cycle 
      $('#imgcaption').cycle({
          timeout: 0,
          fx: 'scrollHorz',
          speed: 500,
          pager: '#nav',
          pagerAnchorBuilder: function(idx, slide) { 
              return '&lt;a href="#"&gt;&lt;/a&gt;'; 
              }
      });
  </code></pre>