Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No event after a transition's postInit #801

Closed
helderco opened this issue Jan 14, 2017 · 0 comments
Closed

No event after a transition's postInit #801

helderco opened this issue Jan 14, 2017 · 0 comments

Comments

@helderco
Copy link

There's no event after a transition's postInit function. The carousel transition appends and prepends extra elements with cloneNode, in postInit. The problem is that it's not cloning a custom .data('colorbox') config object.

    postInitSlideshow: function() {
        var opts = this.opts();
        opts.API.trigger('cycle-post-initialize', [ opts ]);
        var tx = $.fn.cycle.transitions[opts.fx];
        if (tx && $.isFunction(tx.postInit))
            tx.postInit( opts );
    },

Maybe just add this?

    postInitSlideshow: function() {
        var opts = this.opts();
        opts.API.trigger('cycle-post-initialize', [ opts ]);
        var tx = $.fn.cycle.transitions[opts.fx];
        if (tx && $.isFunction(tx.postInit)) {
            tx.postInit( opts );
            opts.API.trigger('cycle-tx-post-initialize', [opts]);
        }
    },

You can then check with opts.fx which transition it is.

For now, I've added this in custom code:

  $.fn.cycle.transitions.carousel.oldPostInit = $.fn.cycle.transitions.carousel.postInit;
  $.fn.cycle.transitions.carousel.postInit = function (opts) {
    this.oldPostInit(opts);
    opts.container.trigger('cycle-carousel-post-initialize', [opts]);
  };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant