// Instantiate and configure Loader: var loader = new YAHOO.util.YUILoader({ base: "http://media.grooveattack.com/javascripts/yui/build/", // Identify the components you want to load. Loader will automatically identify // any additional dependencies required for the specified components. require: ["carousel","animation","button"], // Configure loader to pull in optional dependencies. For example, animation // is an optional dependency for slider. loadOptional: true, // The function to call when all script/css resources have been loaded onSuccess: function() { //this is your callback function; you can use //this space to call all of your instantiation //logic for the components you just loaded. YAHOO.util.Event.onContentReady("news_car", function (ev) { var carousel = new YAHOO.widget.Carousel("news_car", { numVisible: 1, animation: { speed: 1.0 }, scrollIncrement: 1, autoPlay: 8500, isCircular: true, navigation: false } ); //carousel.render(); // get ready for rendering the widget carousel.startAutoPlay(); carousel.show(); // display the widget }); }, // Configure the Get utility to timeout after 10 seconds for any given node insert timeout: 10000, // Combine YUI files into a single request (per file type) by using the Yahoo! CDN combo service. combine: false }); function countChildElements(parent, child) { var parent = document.getElementById(parent); var childCount = parent.getElementsByTagName(child).length; return childCount; } // Load the files using the insert() method. The insert method takes an optional // configuration object, and in this case we have configured everything in // the constructor, so we don't need to pass anything to insert(). loader.insert();