images is not an array use Ox.forEach
This commit is contained in:
parent
498b17926f
commit
09e97fa08b
1 changed files with 10 additions and 8 deletions
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue