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

trigger custom events #9

Open
aurmil opened this issue Jan 7, 2014 · 7 comments
Open

trigger custom events #9

aurmil opened this issue Jan 7, 2014 · 7 comments

Comments

@aurmil
Copy link

aurmil commented Jan 7, 2014

hello
I needed to get a callback after switching background (to change pagination active item)
I added

this.$el.trigger('switchcomplete', [this.index]);

at the end of the switching function (l. 277)
may be this point could be added to your plugin
regards

@rewish
Copy link
Owner

rewish commented Mar 27, 2014

So good idea! I'll consider it :)
Thanks.

@lucabit73
Copy link

Hi aurmil, I'm very interested with your issue to add a callback, can you explain how to do it? How you pass that callback?
Thanks

@aurmil
Copy link
Author

aurmil commented Oct 20, 2014

hi
I used jQuery.BgSwitcher v0.4.2
as mentionned, I added the code above at the end of the "switching" function
and in your own JS code:

$('CSS path to bgSwitcher container').bgswitcher({
// options
});

$('CSS path to bgSwitcher container').bind('switchcomplete', function(event, index) {
// do domething
});

@lucabit73
Copy link

hi aurmil, thanks a lot for your (very fast!) help, I found your code very useful.
;-)

@aurmil
Copy link
Author

aurmil commented Oct 20, 2014

you are welcome, happy to help :)

@hourdays
Copy link

As soon as I searched for help on how to achieve this trigger, I found your post and had it working fine in version 0.4.3.

Indeed I added this.$el.trigger('switchcomplete', [this.index]); after line 236 in switching function.

Then I added $('BODY').bind('switchcomplete', function(event, index) { alert('Hello!'); }); in my html page.

Thanks a lot!

@marcomoser
Copy link

I'm using:
switching: function() {
this.$el.trigger('switcher_before', [this.index]);
....
this.$el.trigger('switcher_after', [this.index]);
}

many thanks

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

5 participants