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

Initialized is called twice if the plugin is called twice #112

Open Mottie opened 11 years ago

Mottie commented 11 years ago

The following code (demo):

$('#slider').movingBoxes({
   initialized: function (e, slider, tar) {
        console.log('initialized');
    },
    // callback upon change panel initialization
    initChange: function (e, slider, tar) {
        console.log('init changed');
    },
    // callback before any animation occurs
    beforeAnimation: function (e, slider, tar) {
       console.log('before animation');
    },
    // callback after animation completes
    completed: function (e, slider, tar) {
        console.log('completed');
    }
});
$('#slider').movingBoxes();

will result in this in the console

completed initialized initialized

Fix the plugin so the completed event isn't called in this situation, and initialized is only called once.