idiot/unslider — pull request #30 by turtleguyy (2013-03-29 03:15:54+00:00)
Title: Fixed fluid width calculations.

When finding out how wide the slider should be, you were adding the padding of the slider's container. this meant the slider would get exponentially smaller when resizing the screen.

For instance, let's say the container was 1000px wide, and the slider was 980px wide. The code currently in there says the slider should be set to 98% wide. Makes perfect sense.

Now, using that same scenario, let's give the container 10px of padding on each side. The calculations say the slider should be set to 98% wide, so that's what it does. However, since the available space for the slider to take up is actually 980px because of that padding, the slider shrinks a bit the first time this runs. Then, since 98% of 980px is smaller 980px, the next calculation starts off with bad data. When resizing the window, bad things happen quickly.

By using .width() instead of .outerWidth(), we leave out padding when calculating the slider container's width. In our scenario up there, the slider would be correctly set to 100% width. All make sense?