Skip to content

Commit 47fb2c6

Browse files
committed
issue-33-width-issue
* Really fixed the width issue. Using _scrollWidth_ works well and does not require checking the wrapper width.
1 parent 272baf3 commit 47fb2c6

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

dist/angular-bootstrap-toggle.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,8 @@
172172
} else {
173173
var wrapperComputedWidth = Math.max(
174174
self.onElement.scrollWidth,
175-
self.offElement.scrollWidth) + 24;
176-
var wrapperWidth = self.wrapperElement.scrollWidth;
177-
178-
if (wrapperWidth < wrapperComputedWidth) {
179-
$scope.wrapperStyle.width = wrapperComputedWidth + 'px';
180-
} else {
181-
$scope.wrapperStyle.width = wrapperWidth + 'px';
182-
}
175+
self.offElement.scrollWidth) + 12;
176+
$scope.wrapperStyle.width = wrapperComputedWidth + 'px';
183177
}
184178

185179
// Calculate the proper height

dist/angular-bootstrap-toggle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/angular-bootstrap-toggle.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,8 @@
172172
} else {
173173
var wrapperComputedWidth = Math.max(
174174
self.onElement.scrollWidth,
175-
self.offElement.scrollWidth) + 24;
176-
var wrapperWidth = self.wrapperElement.scrollWidth;
177-
178-
if (wrapperWidth < wrapperComputedWidth) {
179-
$scope.wrapperStyle.width = wrapperComputedWidth + 'px';
180-
} else {
181-
$scope.wrapperStyle.width = wrapperWidth + 'px';
182-
}
175+
self.offElement.scrollWidth) + 12;
176+
$scope.wrapperStyle.width = wrapperComputedWidth + 'px';
183177
}
184178

185179
// Calculate the proper height

0 commit comments

Comments
 (0)