var productViewer = function(element) {
this.element = element;
this.handleContainer = this.element.find('.cd-product-viewer-handle');
this.handleFill = this.handleContainer.children('.fill');
//...
this.frames = this.element.data('frame');
//increase this value to increase the friction while dragging on the image - it has to be bigger than zero
this.friction = this.element.data('friction');
this.visibleFrame = 0;
this.loaded = false;
//...
this.loadFrames();
}
productViewer.prototype.loadFrames = function() {
var self = this,
imageUrl = this.slideShow.data('image');
//you need this to check if the image sprite has been loaded
$('
').attr('src', imageUrl).load(function() {
self.loaded = true;
});
this.loading('0.5'); //triggers loading animation
}
var productToursWrapper = $('.cd-product-viewer-wrapper');
productToursWrapper.each(function(){
new productViewer($(this));
});