Skip to content

Commit

Permalink
keep track of image size in an object since IE can't find image sizes…
Browse files Browse the repository at this point in the history
… when they aren't on the DOM
  • Loading branch information
kevin1024 committed Feb 29, 2012
1 parent a19c29b commit a950273
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions js/jquery.galleryview-3.0-dev.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
GalleryView - jQuery Content Gallery Plugin GalleryView - jQuery Content Gallery Plugin
Author: Jack Anderson Author: Jack Anderson
Version: 3.0 DEVELOPMENT Version: 3.0 DEVELOPMENT (hacked by kevin1024)
See README.txt for instructions on how to markup your HTML See README.txt for instructions on how to markup your HTML
*/ */
Expand Down Expand Up @@ -393,16 +393,23 @@ if (typeof Object.create !== 'function') {


initImages: function() { initImages: function() {
var self = this, var self = this,
dom = this.dom; dom = this.dom,
size_map = {};


$.each(this.gvImages,function(i,gvImage) { $.each(this.gvImages,function(i,gvImage) {
var img = $('<img/>'); var img = $('<img/>');
img.hide().data('index',i); img.hide().data('index',i);
img.bind('load.galleryview',function() { img.bind('load.galleryview',function() {
if ($(this).width() || this.width) {
size_map[$(this).attr('src')] = [$(this).width()||this.width,$(this).height()||this.height];
}
if (typeof(size_map[$(this).attr('src')]) === 'undefined') {
return;
}
var _img = $(this), var _img = $(this),
index = _img.data('index'), index = _img.data('index'),
width = this.width, width = size_map[$(this).attr('src')][0],
height = this.height, height = size_map[$(this).attr('src')][1],
parent = _img.parent(), parent = _img.parent(),
widthFactor = gv.innerWidth(parent) / width, widthFactor = gv.innerWidth(parent) / width,
heightFactor = gv.innerHeight(parent) / height, heightFactor = gv.innerHeight(parent) / height,
Expand Down

0 comments on commit a950273

Please sign in to comment.