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

Feature request: 'random' value for axis #32

Closed
Seb33300 opened this issue Jul 16, 2015 · 6 comments
Closed

Feature request: 'random' value for axis #32

Seb33300 opened this issue Jul 16, 2015 · 6 comments

Comments

@Seb33300
Copy link

I think it could be interesting to add value 'random' for the axis param.
So blocks will flip randomly on x or y axis.

@Download
Copy link
Collaborator

Mmmm I'm not sure... Now we want to change axis randomly, next it will be some pattern, or changing the reverse parameter... Where does it end?

Maybe it would be a better idea to fire a 'onflip' event or something? That way the client of the library can attach an event handler that changes whatever he wants to change after the flip:

$('#card').flip().on('flip', function(evt){
  var newAxis;
  // determine new axis randomly or whatever...
  $(this).flip({axis: newAxis});
});

@JemarJones
Copy link
Collaborator

I agree that a feature like this doesn't really belong in flip.

I like your idea @Download, though I think it might make the most sense to create a custom jquery event that anyone can use in the normal jquery way?

@Download
Copy link
Collaborator

Yes, i agree. A custom jQuery event would be the way to go. I have no experience with it however and (atm) no time to work on it...

@JemarJones
Copy link
Collaborator

I also have no experience with it, but I've enough time so Ill give it a go.

In your example is the function meant to be called on complete? This makes the most sense but I think @Seb33300 would need it to be called before each flip took place. Which would be a little messy to implement just because changing the axis is async itself

I think all that needs to be done is determining the new axis and setting it. This is a client side concern though.

Still, I'm interested in the sort of persistent callback idea so I'll try to work on that.

@Download
Copy link
Collaborator

@JemarJones Yes I think you are right. Most beatiful solution would probably be if you could do things like event.preventDefault(); to cancel the flip etc.

However firing it on completion will also solve most use cases I think... Maybe we need an init event as well then so you would be able to change the initial settings as well...

@JemarJones
Copy link
Collaborator

jQuery events added in https://github.com/nnattawat/flip/releases/tag/v1.0.14

@Seb33300 I apologize for the highjacking of your issue! Unfortunately i believe its generally agreed upon that your suggestion doesn't quite belong in flip, but can be done with client code rather easily!

Closing now.

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

3 participants