Skip to content

Commit

Permalink
Adding an extra pixel once in a while, due to the earlier removal of …
Browse files Browse the repository at this point in the history
…sub-pixel widths, which resulted in the slider sometimes being to small. Fixes #56
  • Loading branch information
erik-krogh committed May 20, 2016
1 parent 9ddfd36 commit adbfb02
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 46 deletions.
18 changes: 15 additions & 3 deletions js/jquery.sudoSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,22 @@
return;
}

var newWidth = parseInt10(getResponsiveWidth());
var subPixelNewWidth = getResponsiveWidth();
var newWidth = parseInt10(subPixelNewWidth);
var addAPixelEvery = 1 / (subPixelNewWidth - newWidth);

if (previousAdjustedResponsiveWidth != newWidth || (forced === TRUE)) {
previousAdjustedResponsiveWidth = newWidth;

var slideCounter = 1;
for (var i = 0; i < totalSlides; i++) {
slides[i].width(newWidth);
slideCounter++;
if (slideCounter >= addAPixelEvery) {
slideCounter = 0;
slides[i].width(newWidth + 1);
} else {
slides[i].width(newWidth);
}
}
if (autoStartedWithPause !== FALSE) {
startAuto(autoStartedWithPause);
Expand Down Expand Up @@ -1706,7 +1715,10 @@
return function foo() {
var reinit = !destroyed;
if (!init && !fullyInitialized) {
callAsync(foo.bind.apply([undefined].concat(arguments))); // Fixing a very special, special case
var args = arguments;
callAsync(function () {
foo.apply(undefined, args);
}); // Fixing a very special, special case
return;
}
publicDestroy();
Expand Down
Loading

0 comments on commit adbfb02

Please sign in to comment.