images is not an array use Ox.forEach

This commit is contained in:
j 2011-04-23 00:46:37 +02:00
parent 498b17926f
commit 09e97fa08b

View file

@ -18,14 +18,14 @@ Ox.Flipbook = function(options, self) {
timestamp = $('<div>').css({
'position': 'absolute',
'text-align': 'center',
'width': '100%',
'width': '100%'
})
.hide(),
that = new Ox.Element('div', self)
.defaults({
frames: {},
duration: 0,
icon: '',
icon: ''
})
.options(options || {})
.append(icon)
@ -66,9 +66,10 @@ Ox.Flipbook = function(options, self) {
function getFrame(position) {
var frame;
frames.forEach(function(img, i) {
if (!frame || i <= position)
Ox.forEach(frames, function(img, i) {
if (!frame || i <= position) {
frame = img;
}
});
return frame;
}
@ -78,7 +79,7 @@ Ox.Flipbook = function(options, self) {
frames[i] = new Image();
frames[i].onload = function() {
frameHeight = frames[i].height / frames[i].width * that.width();
}
};
frames[i].src = src;
});
}
@ -89,10 +90,11 @@ Ox.Flipbook = function(options, self) {
} else if (key == 'icon') {
icon.attr('src', value);
}
}
};
if(options.icon)
if(options.icon) {
icon.attr('src', options.icon);
}
cacheFrames();
return that;
};