4

I want to perform a callback function ("revealContent") after the slide transition, but I don't want that function to run when jQuery Cycle first initializes (which it does). Any suggestions?

    $(this).find('.content').cycle({
        timeout: 0,
        startingSlide: 3,
        fx: 'scrollHorz',
        speed: 700,
        easing: 'easeOutQuint',
        pager:  $(this).prev('.tabs'), 
        pagerAnchorBuilder: function(idx, slide) {
            return '#portfolio li#'+thisID+' .tabs li:eq(' + idx + ')'; 
        },
        after: revealContent
    });
Derek J
  • 41
  • 1

2 Answers2

3

I was having this same problem, and after looking through the plugin code (in my case, the cycle.all version, dont know if it is available in the lite one), found an undocumented option for this:

skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition

I just tried and it works perfectly. Hope it is useful.

agente_secreto
  • 7,959
  • 16
  • 57
  • 83
2

Set a variable at 1 when the page load. In the callback check if the variable: if it's one, set it to 0, if it's 0 do revealContent ?

Simon marc
  • 1,003
  • 7
  • 8
  • Genius! Sometimes the simplest solutions are the right ones...I kept looking for a Cycle native flag or option. – matt May 16 '11 at 17:05