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

Render breaking in IE11 (container width) #591

Open
fabrypel opened this issue Sep 14, 2016 · 2 comments
Open

Render breaking in IE11 (container width) #591

fabrypel opened this issue Sep 14, 2016 · 2 comments
Assignees

Comments

@fabrypel
Copy link

image

image

I changed this code (in "BootstrapSwitch.prototype._width"):
this.$container.width((this._handleWidth * 2) + this._labelWidth);
with this:
var containerWidth = Math.round(((this.$on.outerWidth() + this.$off.outerWidth()) + this._labelWidth) * 100) / 100;
this.$container.width(containerWidth);

It's correct? there is a best way ?
Thank you.

@xszaboj
Copy link

xszaboj commented Nov 2, 2016

Hi guys,
I have similar problem.
code
When I resize the size of the screen or sometimes when I load the screen. The button has two rows as in image above.
Problem is that on first button the width is calculated incorrectly (144.38px).
But on the other one it is fine (144.39px).
Is this some kind of rounding issue. Could somebody please point me to the function that calculate this so I could debug this?
Thanks for help.

Edit:

I've tried fabrypel code. And that fixed the IE problem for me.
However it break the button on Safari :(.
So I fixed the problem on all browsers by this line:
this.$container.width((this._handleWidth * 2) + this._labelWidth + 0.3);
0.3 is important bit here. I looks like it rounds incorrectly on different browsers, but usually just by 0.1px. so adding 0.3px fix the problem everywhere for me.

@LostCrew
Copy link
Member

LostCrew commented Feb 7, 2017

@xszaboj I've merged this recently (#582). Can you test v3.3.3 and report back?

@LostCrew LostCrew self-assigned this Feb 7, 2017
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