user2835060 user2835060 - 1 year ago 105
jQuery Question

Load JQuery cycle2 on loaded Ajax content

I'm trying to initiate JQuery cycle on external HTML content loaded in with Ajax, but this doesn't seem to work:

$(".container").load("step2.html", function() {
$.fn.cycle.defaults.autoSelector = '.cycle-slideshow';

the html is as follows:

<div class="cycle-slideshow second-prize-slider" data-cycle-manual-speed="2000" data-cycle-slides="p" data-cycle-timeout=5000 >
<p>Jetzt<br />mitmachen & <br />gewinnen</span></p>
<p >T├Ąglich<br>mitspielen & <br> Gewinnchance<br> steigern!</p>

Answer Source

Just call the cycle initializer manually in your callback:

$(".container").load("step2.html", function() {

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download