开发者

jQuery Cycle: Disable Initial 'After' Callback

I wa开发者_StackOverflow社区nt 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
    });


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.


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 ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜