----------
Script: Step Carousel Viewer v1.8
http://www.dynamicdrive.com/dynamici...epcarousel.htm
----------
Scenario:
jQuery AJAX call to retrieve XML document of images to display. If document retrieval successful, parse the XML document with JavaScript/jQuery into proper format for stepcarousel and update the html of the stepcarousel div. Upon invocation of stepcarousel.setup, "what is undefined" error was returned and page went blank/white.
To me, the behavior I received is a bug. I believe it should be adjusted accordingly.
Resolution:
The error occurs because stepcarousel.setup calls document.write in the midst of a jQuery.ajax success function call. After finding this post (http://forums.asp.net/p/1439163/3755493.aspx#3755493), I updated the stepcarousel.setup function to compensate for the issue. The adjusted function is below. By using jQuery to append the style-ing within the head of the document, there are no longer any unforeseen errors.
I wanted to post this, in more detail than the link above, for anyone who may have had the same problem as me. Hope it helps.
Code:setup:function(config){ jQuery(document).ready(function($){ //Disable Step Gallery scrollbars ASAP dynamically (enabled for sake of users with JS disabled) $('head').append('<style type="text/css">\n#'+config.galleryid+'{overflow: hidden;}\n</style>') config.$gallery=$('#'+config.galleryid) stepcarousel.init($, config) }) //end document.ready jQuery(window).bind('unload', function(){ //clean up on page unload stepcarousel.resetsettings($, config) if (config.panelbehavior.persist) stepcarousel.setCookie(config.galleryid+"persist", config.currentpanel) jQuery.each(config, function(ai, oi){ oi=null }) config=null }) }



Reply With Quote
Bookmarks