malsup / cycle2

2nd gen cycling
899 stars 238 forks source link

pager breaks when script loaded by getScript #723

Open barem opened 8 years ago

barem commented 8 years ago

Trying to reduce page load time by loading as much as possible below the fold with ajax. The cycle2 pager and prev/next functionality breaks when the script is loaded this way:

$.getScript("http://example.com/js/jquery.cycle2.js");

It works perfectly loading it as:

The problem lies in line 61 of the dev file where the trigger will not fire when the script is loaded by getScript:

opts.container.trigger( eventName, args );

Here is my html (which I will later attempt to load by ajax after this problem is solved) above my script loading code:

Testimonial 1

-Author 1

Testimonial 2

-Author 2

Any ideas on how to make that trigger fire? Thanks in advance for taking a look!