').css({
width: width,
height: height,
top: t,
left: l,
backgroundImage: 'url(' + src + ')',
backgroundPosition: '-' + left + 'px -' + top + 'px',
backgroundSize: imgWidth + 'px ' + imgHeight + 'px',
transition: 'all ' + _this.Slider.settings.transitionDuration + 'ms ease-in-out ' + delay + 'ms',
transform: 'none'
});
}
_this.$img = _this.Slider.$currentSlide.find('img.huge-it-slide-image');
_this.$grid = $('
').addClass('huge-it-grid');
_this.Slider.$currentSlide.prepend(_this.$grid);
var imgWidth = _this.$img.width(),
imgHeight = _this.$img.height(),
imgSrc = _this.$img.attr('src'),
colWidth = Math.floor(imgWidth / cols),
rowHeight = Math.floor(imgHeight / rows),
colRemainder = imgWidth - (cols * colWidth),
colAdd = Math.ceil(colRemainder / cols),
rowRemainder = imgHeight - (rows * rowHeight),
rowAdd = Math.ceil(rowRemainder / rows),
leftDist = 0,
l = (_this.$grid.width() - _this.$img.width()) / 2;
tx = tx === 'auto' ? imgWidth : tx;
tx = tx === 'min-auto' ? -imgWidth : tx;
ty = ty === 'auto' ? imgHeight : ty;
ty = ty === 'min-auto' ? -imgHeight : ty;
for (var i = 0; i < cols; i++) {
var t = (_this.$grid.height() - _this.$img.height()) / 2,
topDist = 0,
newColWidth = colWidth;
if (colRemainder > 0) {
var add = colRemainder >= colAdd ? colAdd : colRemainder;
newColWidth += add;
colRemainder -= add;
}
for (var j = 0; j < rows; j++) {
var newRowHeight = rowHeight,
newRowRemainder = rowRemainder;
if (newRowRemainder > 0) {
add = newRowRemainder >= rowAdd ? rowAdd : rowRemainder;
newRowHeight += add;
newRowRemainder -= add;
}
_this.$grid.append(gridlet(newColWidth, newRowHeight, t, l, topDist, leftDist, imgSrc, imgWidth, imgHeight, i, j));
topDist += newRowHeight;
t += newRowHeight;
}
leftDist += newColWidth;
l += newColWidth;
}
_this.listenTo = _this.$grid.children().last();
_this.$grid.show();
_this.$img.css('opacity', 0);
_this.$grid.children().first().addClass('huge-it-top-left');
_this.$grid.children().last().addClass('huge-it-bottom-right');
_this.$grid.children().eq(rows - 1).addClass('huge-it-bottom-left');
_this.$grid.children().eq(-rows).addClass('huge-it-top-right');
};
this.execute = function () {
_this.$grid.children().css({
opacity: op,
transform: 'rotate(' + ro + 'deg) translateX(' + tx + 'px) translateY(' + ty + 'px) scale(' + sc + ')'
});
};
this.before($.proxy(this.execute, this));
this.reset = function () {
_this.$img.css('opacity', 1);
_this.$grid.remove();
}
};
Transition.prototype.slice_h = function () {
this.grid(1, 8, 0, 'min-auto', 0, 1, 0);
};
Transition.prototype.slice_v = function () {
this.grid(10, 1, 0, 0, 'auto', 1, 0);
};
Transition.prototype.slide_v = function () {
var dir = this.forward ?
'min-auto' :
'auto';
this.grid(1, 1, 0, 0, dir, 1, 1);
};
Transition.prototype.slide_h = function () {
var dir = this.forward ?
'min-auto' :
'auto';
this.grid(1, 1, 0, dir, 0, 1, 1);
};
Transition.prototype.scale_out = function () {
this.grid(1, 1, 0, 0, 0, 1.5, 0);
};
Transition.prototype.scale_in = function () {
this.grid(1, 1, 0, 0, 0, .5, 0);
};
Transition.prototype.block_scale = function () {
this.grid(8, 6, 0, 0, 0, .6, 0);
};
Transition.prototype.kaleidoscope = function () {
this.grid(10, 8, 0, 0, 0, 1, 0);
};
Transition.prototype.fan = function () {
this.grid(1, 10, 45, 100, 0, 1, 0);
};
Transition.prototype.blind_v = function () {
this.grid(1, 8, 0, 0, 0, .7, 0);
};
Transition.prototype.blind_h = function () {
this.grid(10, 1, 0, 0, 0, .7, 0);
};
Transition.prototype.random = function () {
this[this.anims[Math.floor(Math.random() * this.anims.length)]]();
};
Transition.prototype.custom = function () {
if (this.Slider.nextAnimIndex < 0) {
this.Slider.nextAnimIndex = this.customAnims.length - 1;
}
if (this.Slider.nextAnimIndex === this.customAnims.length) {
this.Slider.nextAnimIndex = 0;
}
this[this.customAnims[this.Slider.nextAnimIndex]]();
};
var testBrowser = {
browserVendors: ['', '-webkit-', '-moz-', '-ms-', '-o-', '-khtml-'],
domPrefixes: ['', 'Webkit', 'Moz', 'ms', 'O', 'Khtml'],
testDom: function (prop) {
var i = this.domPrefixes.length;
while (i--) {
if (typeof document.body.style[this.domPrefixes[i] + prop] !== 'undefined') {
return true;
}
}
return false;
},
cssTransitions: function () {
if (typeof window.Modernizr !== 'undefined' && Modernizr.csstransitions !== 'undefined') {
return Modernizr.csstransitions;
}
return this.testDom('Transition');
},
cssTransforms3d: function () {
if (typeof window.Modernizr !== 'undefined' && Modernizr.csstransforms3d !== 'undefined') {
return Modernizr.csstransforms3d;
}
if (typeof document.body.style['perspectiveProperty'] !== 'undefined') {
return true;
}
return this.testDom('Perspective');
}
};
$.fn['sliderPlugin'] = function (settings) {
return this.each(function () {
if (!$.data(this, 'sliderPlugin')) {
$.data(this, 'sliderPlugin', new Slider(this, settings));
}
});
}
})(window.jQuery, window, window.document);
jQuery(window).load(function () {
jQuery('div[class*=slider-loader-]').css({
display: 'none'
});
jQuery('.huge-it-wrap, .rwd-SlideOuter, .huge-it-slider').css({
opacity: '1'
});
});