Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Fix two bugs. One with the toggle behavior of the switch, and one with the height of the switch. #5

Merged
merged 2 commits into from
Jan 13, 2016

Conversation

timchang
Copy link

No description provided.

In the off state, if you click on the label the switch does not toggle.
 This is because the offset is non-zero, which makes the difference
non-zero, which makes switch behave as if it’s been dragged to the off
state.

The fix is to only calculate the state based on the difference if the
switch was dragged.  And it’s only dragged if the mouse has moved at
some point after the initial dragStart.

I took a look at the original bootstrap switch and it’s how it behaves
too.
When using the switch, I get a massive height.  It’s the same as the
issue reported here:
Bttstrp#360

As I understand it, height specifies the height of an element relative
to its parent container, so 100% is the same height as its parent.
https://www.w3.org/TR/CSS21/visudet.html#propdef-height

However, I think it makes sense for a switch to be defined by its
internal height (as dictated by its size / content).
@develra
Copy link

develra commented Jan 13, 2016

Seconded. @timchang, I'm going to use your fork for now.

Julusian added a commit that referenced this pull request Jan 13, 2016
Fix two bugs.  One with the toggle behavior of the switch, and one with the height of the switch.
@Julusian Julusian merged commit 65e81ca into Julusian:master Jan 13, 2016
@Julusian
Copy link
Owner

Sorry for taking to long to merge this.
It has been published on npm as v3.4.1

@timchang
Copy link
Author

No worries. Hope you had an enjoy holiday. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants