I implemented imageScroll.js on my website and get the following error message:
Uncaught TypeError: Cannot read property 'left' of undefined'
The error refers to the line 233 within the file imageScroll.js which says
winWidth = $win.width() - this.settings.container.offset().left,
When I check the "this" element for the current content I get
console.log($(this));
VM2442:2 [Window, jquery: "2.1.3", constructor: function, selector: "", toArray: function, get: function…]
console.log(this);
Window {top: Window, window: Window, location: Location, external: Object, chrome: Object…}
Unfortunately, this doesn't tell me too much.
Here is the website where the error occurs.
I appreciate any hints or ideas how to solve this problem!
Cheers!
Eric
The image scroll plugin for jQuery does not work properly
var touch = Modernizr.touch;
t = 0;
image = document.getElementsByClassName("img-holder")[t].attributes[1].childNodes[0].data;t++
$('.img-holder').imageScroll({
imageAttribute: (touch === true) ? "" + image : 'image',
touch: touch
});
This almost works but then
this.image = this.$imageHolder.data(this.settings.imageAttribute) || this.settings.image;
line 187 in imageScroll plugin for jQuery
but this.$imageHolder.data(this.settings.imageAttribute)
returns undefined and this.settings.image
is used which is null
This is the core of the problem i have yet to figure out how to make jQuery return the string of the image-data tags on the img elements that we need
https://github.com/pederan/Parallax-ImageScroll was suggested to me by the author of the question but it would require some rework which I am not interested in helping with
EDIT:
var touch = Modernizr.touch;
t = 0;
image = document.getElementsByClassName("img-holder");
$('.img-holder').imageScroll({
imageAttribute: (touch === true) ? image : 'data-image',
touch: touch
});
works perfectly without errors but the images end up being [Object object] as a source