Skip to content

Commit

Permalink
use strict & cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Sep 18, 2012
1 parent 08b570c commit 14308d1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
12 changes: 12 additions & 0 deletions README.markdown
Expand Up @@ -10,6 +10,18 @@

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

### Version 2.3 (9/18/2012)

* Added a method to check when all images have loaded, then reevaluate the height of each panel.
* The plugin that was incorporated is called [imagesLoaded](https://github.com/Mottie/imagesLoaded).
* This entailed rewritting and fixing the plugin initialization function ([issue #92](https://github.com/CSS-Tricks/MovingBoxes/issues/92) and initAnimation problems ([issue #79](https://github.com/CSS-Tricks/MovingBoxes/issues/79)).
* I hope this also includes fixing whatever is going on in [issue #62](https://github.com/CSS-Tricks/MovingBoxes/issues/62).
* Added a `delayBeforeAnimate` option:
* The `beforeAnimation` event will be fired, then the animation will be delayed by the value in `delayBeforeAnimate` in milliseconds.
* See [issue #80](https://github.com/CSS-Tricks/MovingBoxes/issues/80) on how this could be useful :). Thanks to [Alfazo](https://github.com/Alfazo) for the suggestion.
* Modified the layout so that the UL now gets the margin to center the panels within the frame instead of the first LI. This fixes the animation jump seen when switching from the second to first panel.
* Removed byte order mark (BOM) from the js files. Fix for [issue #94](https://github.com/CSS-Tricks/MovingBoxes/issues/94).

### Version 2.2.16 (8/17/2012)

* Added new styling to the demo pages (Chris)
Expand Down
13 changes: 6 additions & 7 deletions js/jquery.movingboxes.js
Expand Up @@ -4,6 +4,7 @@
* http://css-tricks.com/moving-boxes/
*/
;(function($){
"use strict";
$.movingBoxes = function(el, options){
// To avoid scope issues, use 'base' instead of 'this'
// to reference this class from internal events and functions.
Expand Down Expand Up @@ -347,7 +348,7 @@

if (o.delayBeforeAnimate) {
// delay starting slide animation
setTimeout(function(d){
setTimeout(function(){
base.animateBoxes(curPanel, ani, t, flag, callback);
}, parseInt(o.delayBeforeAnimate, 10) || 0);
} else {
Expand Down Expand Up @@ -384,14 +385,12 @@
};

base.endAnimation = function(){

// Update navigation links
if (o.buildNav && base.$nav.length) {
base.$nav.find('a.mb-link')
.removeClass(o.currentPanel)
.eq(base.curPanel - 1).addClass(o.currentPanel);
}

};

base.updateArrows = function(cur){
Expand Down Expand Up @@ -444,12 +443,12 @@
};

// based on https://github.com/Mottie/imagesLoaded plugin
base.imagesLoaded = function(callback, img, cycling) {
base.imagesLoaded = function(callback, img) {
var i, ic,
c = true, // complete flag
t = img ? $(img) : base.$panels.find('img'),
l = t.length,
img = img || []; // array of images that didn't complete
l = t.length;
img = img || []; // array of images that didn't complete
for ( i = 0; i < l; i++ ) {
if (t[i].tagName === "IMG") {
// IE: fileSize property = -1 before image has loaded & if image load error, so if false is returned
Expand All @@ -472,7 +471,7 @@
} else {
// some images not loaded, rinse & repeat
setTimeout(function(){
base.imagesLoaded( callback, img, true );
base.imagesLoaded(callback, img);
}, 200);
}
};
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.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "MovingBoxes",
"version": "2.2.16",
"version": "2.3",
"title": "MovingBoxes",
"author": {
"name": "Chris Coyier",
Expand Down

0 comments on commit 14308d1

Please sign in to comment.