PDA

View Full Version : Delay & Callback for Featured Content Glider



Pete Campbell
11-29-2010, 04:17 PM
http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.htm
This is not a bug or question post. I have added 2 features and wanted to contribute them (not sure if this is the right place or not).

Feature 1 - Delay the initial slide action so the glider doesn't immediately slide when the page is loaded. The first slide action should occur after the specified delay

In the init script:


featuredcontentglider.init({...
autorotatedelayfirst: true //Delay the first transition so it doesn't occur immediately
})

In FeaturedContentGlider.js


setuptoggler:function($, config){...
config.$togglerdiv.fadeIn(1000, function(){
config.autorotatedelayfirst ? config.nextslideindex = config.selected : featuredcontentglider.glide(config, config.selected)


Feature 2 - Add a callback after the slide action finishes

In the init script


featuredcontentglider.init({...
finished_callback: function(selector) { loadSliderAjax(selector); }


In FeaturedContentGlider.js


var featuredcontentglider={...
if (config.$togglerdiv.attr('lastselected')==null || parseInt(config.$togglerdiv.attr('lastselected'))!=selected){...
if (config.finished_callback != null) config.finished_callback($target);

ddadmin
11-30-2010, 05:27 AM
Great, thanks for posting the new additions!