CSS-Tricks / MovingBoxes

Simple horizontal slider which grows up the current box when it's in focus (image, title & text) and back down when it's not in focus.
http://css-tricks.github.io/MovingBoxes/
GNU Lesser General Public License v3.0
280 stars 147 forks source link

Current slide's CSS class doesn't stick -- found a fix #35

Closed vossavant closed 13 years ago

vossavant commented 13 years ago

I came across a bug whereby the current slide does not keep the "current" class, and applied a fix to the code.

On line 203 you'll find this:

var panels = base.$panels.eq(num-1);

It should be changed to this:

var panels = base.$panels.eq(num-1).addClass(base.options.currentPanel);

Mottie commented 13 years ago

Hi Vossavant!

Thanks for reporting this. I just updated the plugin to version 2.1.3, but I actually added the code to line 218 (line numbering shifted by one) inside the completed function. I found it was better to update the current class after the animation completed in case there are any css definitions that might conflict with the animation (e.g. width, height or font size settings).

The problem was it was using $(this) (no clue why I did that) instead of base.$panels.eq(num-1)

Thanks again!