View Full Version : Ajax-loading from Step Carousel

07-03-2011, 06:26 PM
1) Script Title: :: Step Carousel Viewer

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm

3) Describe problem: By clicking on a link should be loaded content from other page in a specific div. The content, which is reloaded, includes two carousels. Unfortunately, the carousels are not working, because the setup of stepcarousel not matter anyway. I get the error:
TypeError: Result of expression 'what' [undefined] is not an object. How do I initialize this correct?

http://www.3design-gmbh.de/ click REFERENZEN -> with reloading, carousels do not work
http://www.3design-gmbh.de/referenzen/printdesign.html -> without reloading, carousels are working

Please help me. I'm totally confused ...


07-04-2011, 08:01 AM
Ah this isn't an issue with the script, but rather, just a pesky limitation of Ajax. Pages fetched via Ajax should they contain JavaScripts within it in many cases won't run correctly when brought over this way. Ajax basically copies the contents of the external file similar to copying plain text and just dumps it onto the main page. Any runtime scripts on those pages won't be run when they are added to the main page, such as the initialization code of Step Carousel:

galleryid: 'mygallery', //id of carousel DIV
beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
panelclass: 'panel', //class of panel DIVs each holding content
autostep: {enable:true, moveby:1, pause:3000},
panelbehavior: {speed:500, wraparound:false, wrapbehavior:'slide', persist:true},
defaultbuttons: {enable: true, moveby: 1, leftnav: ['http://i34.tinypic.com/317e0s5.gif', -5, 80], rightnav: ['http://i38.tinypic.com/33o7di8.gif', -20, 80]},
statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
contenttype: ['inline'] //content setting ['inline'] or ['ajax', 'path_to_external_file']

There is no quick fix to this unfortunately.

07-04-2011, 10:46 AM
Mh, that's a pity. Is there no workaround for this problem? Perhaps I could load the empty stepcarousel-"frame" with the scripts in an invisible div and make visible only later. Must always be a file (path_to_external_file) in the setup when contenttype=ajax? Or the option can remain empty? Is it possible to change path_to_external_file in the setup later via Javascript?


07-04-2011, 05:52 PM
This (http://www.let.rug.nl/molendyk/include_ajax_plus_code_best_way/includer.html) may be of some help.
Arie Molendijk.