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

Animation not set up with bootstrap.js #381

Closed
frapontillo opened this issue Nov 20, 2014 · 3 comments
Closed

Animation not set up with bootstrap.js #381

frapontillo opened this issue Nov 20, 2014 · 3 comments
Assignees
Labels
Milestone

Comments

@frapontillo
Copy link
Contributor

If I set up an animated switch (which is the default), the switch won't add the bootstrap-switch-animate until the middle handler is clicked; this means that clicking on the labels will toggle the switch but won't animate it until at least one click is triggered on the handler.

$('#theSwitch').bootstrapSwitch({
  state: false,
  animate: true
});

A live demo is available at http://plnkr.co/edit/xGaH6qHhgOUw9qyQ7yrC?p=preview.

Also, could you please specify if this plugin needs bootstrap.js? Because if I remove bootstrap.js from the referenced scripts, the bootstrap-switch-animate is indeed added! The counter-effect is that the switch (being in a false state since the initialization) will animate from true to false upon initialization. You can try all of this in the demo I already linked.

@LostCrew
Copy link
Member

@frapontillo i'm aware of the issue. thanks for the detailed description.
transition is not needed, but currently its inclusion changes the way the switch is initialised. with it, i can listen to the simulated event transitionEnd and attach my callback (adding the -animate class), otherwise the class is added immediately, therefore when the container position is calculated the css transition takes place.

@LostCrew LostCrew added the bug label Nov 24, 2014
@LostCrew LostCrew modified the milestone: 3.2.3 Nov 24, 2014
@LostCrew
Copy link
Member

@frapontillo please check out latest develop branch. it should work as expected now.

@frapontillo
Copy link
Contributor Author

Confirmed. 👯

@LostCrew LostCrew assigned LostCrew and unassigned LostCrew Dec 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants