JQuery loop: disable the initial “after” callback

I want to execute a callback function ("showContent") after the slide transition, but I do not want this function to be executed when the jQuery loop is initialized (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 }); 
+4
source share
2 answers

I had the same problem, and after looking at the plugin code (in my case, the cycle.all version, I don’t know if it is available in Lite), an undocumented option was found for this:

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

I just tried it and it works great. Hope this is helpful.

+3
source

Set the variable to 1 when the page loads. In the callback, check if the variable is: if it is one, set it to 0, if it 0 does expandContent

+2
source

Source: https://habr.com/ru/post/1335459/


All Articles