Skip to content

Commit

Permalink
skip animation when not resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Jun 13, 2011
1 parent af7ce98 commit e7f0c75
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
3 changes: 3 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

(Only the most recent changes are shown below, see the [wiki page](https://github.com/chriscoyier/MovingBoxes/wiki/Change-Log) for a complete listing)

###Version 2.1.1 (6/13/2011)
* Updated to not animate the panel when the `reducedSize` option is set to `1`. This prevents embeded video from restarting - fix for [issue #31](https://github.com/chriscoyier/MovingBoxes/issues/31).

###Version 2.1 (6/10/2011)
* The script now prevents changing slides before it completes initialization. Fix for [issue #29](https://github.com/chriscoyier/MovingBoxes/issues/29).
* Removed element specific resizing:
Expand Down
36 changes: 23 additions & 13 deletions js/jquery.movingboxes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Moving Boxes v2.1
* Moving Boxes v2.1.1
* by Chris Coyier
* http://css-tricks.com/moving-boxes/
*/
Expand Down Expand Up @@ -190,22 +190,32 @@

// Resize panels to normal
base.returnToNormal = function(num, time){
base.$panels.not(':eq(' + (num-1) + ')')
.removeClass(base.options.currentPanel)
.animate({ width: base.regWidth, fontSize: base.options.reducedSize + 'em' }, (time === 0) ? time : base.options.speed);
var panels = base.$panels.not(':eq(' + (num-1) + ')').removeClass(base.options.currentPanel);
if (base.options.reducedSize === 1) {
panels.css({ width: base.regWidth }); // excluding fontsize change to prevent video flicker
} else {
panels.animate({ width: base.regWidth, fontSize: base.options.reducedSize + 'em' }, (time === 0) ? time : base.options.speed);
}
};

// Zoom in on selected panel
base.growBigger = function(num, time, flag){
base.$panels.eq(num-1)
.animate({ width: base.curWidth, fontSize: '1em' }, (time === 0) ? time : base.options.speed, function(){
// completed event trigger
// even though animation is not queued, trigger is here because it is the last animation to complete
if (base.initialized) {
$(this).addClass(base.options.currentPanel); // add current panel class after animating in case it has sizing parameters
if (flag !== false) { base.$el.trigger( 'completed.movingBoxes', [ base, num ] ); }
}
});
var panels = base.$panels.eq(num-1);
if (base.options.reducedSize === 1) {
panels.css({ width: base.curWidth }); // excluding fontsize change to prevent video flicker
if (base.initialized) { base.completed(num, flag); }
} else {
panels.animate({ width: base.curWidth, fontSize: '1em' }, (time === 0) ? time : base.options.speed, function(){
// completed event trigger
// even though animation is not queued, trigger is here because it is the last animation to complete
if (base.initialized) { base.completed(num, flag); }
});
}
};

base.completed = function(num, flag){
$(this).addClass(base.options.currentPanel); // add current panel class after animating in case it has sizing parameters
if (flag !== false) { base.$el.trigger( 'completed.movingBoxes', [ base, num ] ); }
};

// go forward/back
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.movingboxes.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e7f0c75

Please sign in to comment.