/* ===================================================================== # # emloSlightBox 1.0 # author: http://www.emlogic.pl / kontakt@emlogic.pl || http://codecanyon.net/user/emlogic # # usage: $([selector]).emloSlightBox([options]); # ======================================================================== */ (function($){ $.fn.emloSlightBox = function(options){ var defaults = { slideShowSeconds: 5, backgroundOpacity: .7, showSpeed: 500, delay: 70, outOpacity: .7, overOpacity: 1, thumbCaptionOpacitySpeed: 400, showThumbCaptionSpeed: 400, transitions: [19, 20, 18, 11, 13, 5, 4, 3, 1, 2, 17, 19, 16, 15, 14, 12, 10, 9, 8, 7, 6], shuffleTransitions: true, backgroundClass: 'emloSlightBoxBG', contentClass: 'emloSlightBoxContent', thumbCaptionClass: 'altTag', fullCaptionClass: 'caption', counterClass: 'counter', closeClass: 'close', prevClass: 'prev', nextClass: 'next', slicesContainerClass: 'slices-container', sliceContentClass: 'slice-content', sliceClass: 'slice', playClass: 'play', pauseClass: 'pause', preloaderContainerClass: 'preloader-container', preloaderClass: 'preloader', verticalSlices: 6, horizontalSlices: 6, boxesInLine: 4, boxLines: 3, language: 'en', onComplete: '', onClose: '', onStart: '', text: { pl: { prev: 'poprzednie', next: 'następne', close: 'zamknij', play: 'autoodtwarzanie', pause: 'zatrzymaj autoodwtarzanie' }, en: { prev: 'prev', next: 'next', close: 'close', play: 'slideshow', pause: 'stop slideshow' } }, slideShow: false }, options = $.extend({}, defaults, options), esb = { softName: 'esb', author: 'http://snippets.emlogic.pl / http://www.emlogic.pl / kontakt@emlogic.pl', info: 'If you want to use it - buy it. Please.', domain: 'lightbox.emlogic.pl', objectURL: '', objects: [], objectIndex: 0, windowWidth: $(window).width(), windowHeight: $(window).height(), waitingTime: 0, isRunning: false, isMoving: false, slideShowIntervaler: function(){ if(true === options.slideShow && true === esb.isRunning){ clearTimeout(esb.slideShowInterval); if(false === esb.isMoving){ var percent = Math.floor((esb.waitingTime / (options.slideShowSeconds * 1000)) * 100); esb.waitingTime += 10; if(percent >= 100){ esb.openNext(); } $('#' + options.contentClass + ' #' + options.preloaderClass) .css({width: percent + '%'}); } esb.slideShowInterval = setTimeout(function(){ esb.slideShowIntervaler(); }, 10); } }, replaceInlineHTML: function(){ if(esb.dataType === 'inlineHTML' && false === esb.isMoving){ var newHTML = esb.slicesContainer.find(esb.objectURL + ' > *').clone(true, true); $(esb.objectURL).html(newHTML); return false; } }, close: function(){ if(options.onClose !== '' && options.onClose !== undefined){ options.onClose(); } clearTimeout(esb.errorLoad); clearTimeout(esb.clearSlicesInterval); esb.content .stop() .animate({opacity: 0, height: 0}, function(){ $(this) .html('') .remove(); }); $('#' + options.backgroundClass) .remove(); esb.replaceInlineHTML(); esb.isRunning = false; esb.isMoving = false; esb.objectURL = ''; return false; }, openNext: function(){ if(true === esb.isMoving){ return false; } ++esb.objectIndex; if(esb.objectIndex > esb.objects.length - 1){ esb.objectIndex = 0; } esb.objects[esb.objectIndex].click(); return false; }, openPrev: function(){ if(true === esb.isMoving){ return false; } --esb.objectIndex; if(esb.objectIndex < 0){ esb.objectIndex = esb.objects.length - 1; } esb.objects[esb.objectIndex].click(); return false; }, generateBackgroundAndContainer: function(){ esb.windowWidth = $(window).width(); esb.windowHeight = $(window).height(); $('#' + options.backgroundClass).remove(); $('#' + options.contentClass).remove(); $('body') .append($('
') .attr('id', options.backgroundClass) .css({opacity: options.backgroundOpacity, width: esb.windowWidth + 'px', height: esb.windowHeight + 'px'}) .on('click mousedown', function(){ esb.close(); return false; }) ) .append($('') .attr('id', options.contentClass) .css({opacity: 0}) .animate({opacity: 1}) .append($('') .attr('class', options.prevClass) .attr('href', '#') .html(options.text[options.language].prev) .css({opacity: 0}) .on('click mousedown', function(){ esb.openPrev(); return false; }) ) .append($('') .attr('class', options.nextClass) .attr('href', '#') .html(options.text[options.language].next) .css({opacity: 0}) .on('click mousedown', function(){ esb.openNext(); return false; }) ) .append($('') .attr('class', options.closeClass) .attr('href', '#') .html(options.text[options.language].close) .on('click mousedown', function(){ esb.close(); return false; }) ) .append($('') .attr('id', options.slicesContainerClass) ) .append($('') .attr('class', options.fullCaptionClass) .html('') .css({opacity: 0}) ) .append($('') .attr('class', options.counterClass) .html('') .css({opacity: 0}) ) .append($('') .attr('class', options.playClass) .attr('href', '#') .html(options.text[options.language].play) .css({opacity: 0}) .on('click mousedown', function(){ esb.playPauseToggle(); return false; }) ) .append($('') .attr('class', options.pauseClass) .attr('href', '#') .html(options.text[options.language].pause) .css({opacity: 0}) .on('click mousedown', function(){ esb.playPauseToggle(); return false; }) ) .append($('') .attr('id', options.preloaderContainerClass) .css({opacity: 0}) .css({display: 'none'}) .append($('') .attr('id', options.preloaderClass) ) ) ); if(true === options.slideShow){ options.slideShow = false; esb.playPauseToggle(); } esb.content = $('#' + options.contentClass); esb.slicesContainer = $('#' + options.contentClass + ' #' + options.slicesContainerClass); esb.buttons = $('#' + options.contentClass + ' .' + options.closeClass + ', #' + options.contentClass + ' #' + options.preloaderContainerClass + ', #' + options.contentClass + ' .' + options.prevClass + ', #' + options.contentClass + ' .' + options.nextClass + ', #' + options.contentClass + ' .' + options.playClass + ', #' + options.contentClass + ' .' + options.pauseClass + ', #' + options.contentClass + ' .' + options.fullCaptionClass + ', #' + options.contentClass + ' .' + options.counterClass); if(esb.objects.length <= 1){ $('#' + options.contentClass + ' #' + options.preloaderContainerClass + ', #' + options.contentClass + ' .' + options.prevClass + ', #' + options.contentClass + ' .' + options.nextClass + ', #' + options.contentClass + ' .' + options.playClass + ', #' + options.contentClass + ' .' + options.pauseClass + ', #' + options.contentClass + ' .' + options.counterClass) .remove(); } $(document).keydown(function(e){ if(true === esb.isRunning){ if(e.keyCode === 27){ esb.close(); return false; } if(e.keyCode === 32){ esb.playPauseToggle(); return false; } if(e.keyCode === 39){ esb.openNext(); return false; } if(e.keyCode === 37){ esb.openPrev(); return false; } } }); $(window).resize(function(){ esb.windowWidth = $(window).width(); esb.windowHeight = $(window).height(); $('#' + options.backgroundClass).css({width: esb.windowWidth + 'px', height: esb.windowHeight + 'px'}); }); if(options.onStart !== '' && options.onStart !== undefined){ options.onStart(); } return false; }, openPhoto: function(link){ if(true === esb.isMoving){ return false; } if($(link).attr('href') === esb.objectURL){ return false; } esb.waitingTime = 0; $('#' + options.contentClass + ' #' + options.preloaderClass) .animate({width: 0}, options.showSpeed); esb.replaceInlineHTML(); esb.isMoving = true; if(false === esb.isRunning){ esb.generateBackgroundAndContainer(); } esb.isRunning = true; esb.errorLoad = setTimeout(function(){ esb.isMoving = false; }, 5000); esb.slicesContainer .stop() .animate({opacity: 0}, options.showSpeed, function(){ $(this).html(''); esb.objectURL = $(link).attr('href'); esb.objectIndex = $(link).data('index'); esb.caption = $(link).attr('title'); esb.dataToSlice = ''; esb.dataType = $(link).data('type'); if(esb.objectURL.substring(0, 1) === '#'){ esb.dataType = 'inlineHTML'; } esb.link = $(link); switch(esb.dataType){ case 'ajax': $.ajax({ url: esb.objectURL }).done(function(data){ esb.dataToSlice = $(data); }); break; case 'inlineHTML': esb.dataToSlice = $(esb.objectURL); break; case 'iframe': var width = $(link).data('width'), height = $(link).data('height'); if(width === '' || width === undefined){ width = esb.windowWidth /2; } if(height === '' || height === undefined){ height = esb.windowHeight / 2; } esb.dataToSlice = $('') .attr('allowFullScreen', 'allowFullScreen') .css({width: width + 'px', height: height + 'px', margin: 0, padding: 0}) .attr('src', $(link).attr('href')); break; case undefined: $('') .css({opacity: 0, visibility: 'hidden'}) .appendTo($('body')) .load(function(){ esb.dataToSlice = $('') .css({width: $(this).width() + 'px', height: $(this).height() + 'px', background: 'url(' + $(this).attr('src') + ')'}); $(this).remove(); }) .attr('src', esb.objectURL); break; } esb.showTimeInterval(); }); return false; }, showTimeInterval: function(){ if(esb.dataToSlice !== '' && esb.dataToSlice !== undefined){ esb.showTime(); } else { setTimeout(function(){ esb.showTimeInterval(); }, options.showSpeed); } }, showTime: function(){ clearTimeout(esb.errorLoad); if(false === esb.isRunning){ return false; } esb.objectHeight = esb.dataToSlice.outerHeight(true); esb.objectWidth = esb.dataToSlice.outerWidth(true); esb.verticalSliceWidth = Math.ceil(esb.objectWidth / options.verticalSlices); esb.horizontalSliceHeight = Math.ceil(esb.objectHeight / options.horizontalSlices); esb.boxSliceWidth = Math.ceil(esb.objectWidth / options.boxesInLine); esb.boxSliceHeight = Math.ceil(esb.objectHeight / options.boxLines); esb.buttons .css({opacity: 0}); esb.content .stop() .animate({opacity: 1, width: esb.objectWidth + 'px', height: esb.objectHeight + 'px', marginTop: '-' + (esb.objectHeight / 2) + 'px', marginLeft: '-' + (esb.objectWidth / 2) + 'px'}, function(){ esb.buttons .animate({opacity: 1}); $('#' + options.contentClass + ' .' + options.fullCaptionClass) .html(esb.caption); if(esb.caption === '' || esb.caption === undefined){ $('#' + options.contentClass + ' .' + options.fullCaptionClass) .stop() .css({opacity: 0}); } $('#' + options.contentClass + ' .' + options.counterClass) .html((esb.objectIndex + 1)+ ' / ' + esb.objects.length) .css({display: 'block'}); var transition; if(true === options.shuffleTransitions){ transition = options.transitions[Math.ceil((Math.random() * options.transitions.length) - 1)]; } else { transition = options.transitions[0]; options.transitions.push(options.transitions.shift()); } esb.slicesContainer .css({width: esb.objectWidth + 'px', height: esb.objectHeight + 'px', opacity: 1}); if(transition === 1 || transition === undefined){ for(var x = 0, y = options.verticalSlices; x < y; ++x === true){ esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: esb.verticalSliceWidth + 'px', opacity: 0, left: (x * esb.verticalSliceWidth) + 'px', top: 0, height: 0}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x * esb.verticalSliceWidth) + 'px', top: 0}) ) .stop() .animate({opacity: 1, height: esb.objectHeight + 'px'}, options.showSpeed + (x * Math.random() * options.delay)) ); } } if(transition === 2){ var varHeight; for(var x = 0, y = options.verticalSlices; x < y; ++x === true){ if(x % 2 === 0){ varHeight = esb.objectHeight / 2; } else { varHeight = esb.objectHeight; } esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: esb.verticalSliceWidth + 'px', opacity: 0, left: (x * esb.verticalSliceWidth) + 'px', top: 0, height: 0}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x * esb.verticalSliceWidth) + 'px', top: 0}) ) .stop() .animate({opacity: .5, height: varHeight + 'px'}, (options.showSpeed / 2) + (x * options.delay)) .animate({opacity: 1, height: esb.objectHeight + 'px'}, (options.showSpeed / 2)) ); } } if(transition === 3){ var varTop; for(var x = 0, y = options.verticalSlices; x < y; ++x === true){ if(x % 2 === 0){ varTop = esb.objectHeight; } else { varTop = -esb.objectHeight; } esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: esb.verticalSliceWidth + 'px', opacity: 0, left: (x * esb.verticalSliceWidth) + 'px', top: varTop + 'px', height: esb.objectHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x * esb.verticalSliceWidth) + 'px', top: 0}) ) .stop() .animate({opacity: 1, top: 0}, options.showSpeed + (x * options.delay)) ); } } if(transition === 4){ for(var x = 0, y = options.verticalSlices; x < y; ++x === true){ esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: 0, opacity: 0, left: (x * esb.verticalSliceWidth) + 'px', top: 0, height: esb.objectHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x * esb.verticalSliceWidth) + 'px', top: 0}) ) .stop() .animate({opacity: 1, width: esb.verticalSliceWidth + 'px'}, options.showSpeed + (x * options.delay)) ); } } if(transition === 5){ for(var x = 0, y = options.verticalSlices; x < y; ++x === true){ esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: esb.verticalSliceWidth + 'px', opacity: 0, left: (x * esb.verticalSliceWidth) + 'px', top: 0, height: esb.objectHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x * esb.verticalSliceWidth) + 'px', top: 0}) ) .stop() .animate({opacity: .5}, (options.showSpeed / 3) + (x * options.delay)) .animate({opacity: .3}, (options.showSpeed / 3)) .animate({opacity: 1}, (options.showSpeed / 3)) ); } } if(transition === 6){ for(var x = 0, y = options.verticalSlices; x < y; ++x === true){ esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: esb.verticalSliceWidth + 'px', opacity: 0, left: (x * esb.verticalSliceWidth) + 'px', top: esb.objectHeight + 'px', height: esb.objectHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x * esb.verticalSliceWidth) + 'px', top: 0}) ) .stop() .animate({opacity: 1, top: 0}, options.showSpeed + (x * options.delay)) ); } } if(transition === 7){ var varToLeft; for(var x = 0, y = options.verticalSlices; x < y; ++x === true){ if(x % 2 === 0){ varToLeft = esb.verticalSliceWidth; } else { varToLeft = -esb.verticalSliceWidth; } esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: esb.verticalSliceWidth + 'px', opacity: 0, left: ((x * esb.verticalSliceWidth) + varToLeft) + 'px', top: varTop + 'px', height: esb.objectHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x * esb.verticalSliceWidth) + 'px', top: 0}) ) .stop() .animate({opacity: 1, top: 0, left: (x * esb.verticalSliceWidth) + 'px'}, options.showSpeed + (x * options.delay)) ); } } if(transition === 8){ var varOpacity; for(var x = 0, y = options.verticalSlices; x < y; ++x === true){ if(x % 2 === 0){ varOpacity = 1; } else { varOpacity = 0; } esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: esb.verticalSliceWidth + 'px', opacity: varOpacity, left: (x * esb.verticalSliceWidth) + 'px', top: 0, height: esb.objectHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x * esb.verticalSliceWidth) + 'px', top: 0}) ) .stop() .animate({opacity: 1}, options.showSpeed + (x * options.delay)) ); } } if(transition === 9){ var varLeft = ''; for(var x = 0, y = options.horizontalSlices; x < y; ++x === true){ if(x % 2 === 0){ varLeft = -esb.objectWidth; } else { varLeft = esb.objectWidth; } esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: esb.objectWidth + 'px', opacity: 0, left: varLeft + 'px', top: (x * esb.horizontalSliceHeight) + 'px', height: esb.horizontalSliceHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: 0, top: -(x * esb.horizontalSliceHeight) + 'px'}) ) .stop() .animate({opacity: 1, left: 0}, options.showSpeed + (x * options.delay)) ); } } if(transition === 10){ for(var x = 0, y = options.horizontalSlices; x < y; ++x === true){ esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: 0, opacity: 0, left: 0, top: (x * esb.horizontalSliceHeight) + 'px', height: esb.horizontalSliceHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: 0, top: -(x * esb.horizontalSliceHeight) + 'px'}) ) .stop() .animate({opacity: 1, width: esb.objectWidth + 'px'}, options.showSpeed + (x * options.delay)) ); } } if(transition === 11){ for(var x = 0, y = options.horizontalSlices; x < y; ++x === true){ esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: 0, opacity: 0, left: (esb.objectWidth / 2) + 'px', top: (x * esb.horizontalSliceHeight) + 'px', height: esb.horizontalSliceHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: 0, top: -(x * esb.horizontalSliceHeight) + 'px'}) ) .stop() .animate({opacity: 1, left: 0, width: esb.objectWidth + 'px'}, options.showSpeed + (x * options.delay)) ); } } if(transition === 12){ for(var x = 0, y = options.horizontalSlices; x < y; ++x === true){ esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: 0, opacity: 0, left: (esb.objectWidth) + 'px', top: (x * esb.horizontalSliceHeight) + 'px', height: esb.horizontalSliceHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: 0, top: -(x * esb.horizontalSliceHeight) + 'px'}) ) .stop() .animate({opacity: 1, left: 0, width: esb.objectWidth + 'px'}, options.showSpeed + (x * options.delay)) ); } } if(transition === 13){ for(var x = 0, y = options.horizontalSlices; x < y; ++x === true){ esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: 0, opacity: 0, left: 0, top: (x * esb.horizontalSliceHeight) + 'px', height: esb.horizontalSliceHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: 0, top: -(x * esb.horizontalSliceHeight) + 'px'}) ) .stop() .animate({opacity: .5, width: (esb.objectWidth / 2) + 'px'}, (options.showSpeed / 2) + (x * options.delay)) .animate({opacity: 1, width: esb.objectWidth + 'px'}, options.showSpeed / 2) ); } } if(transition === 14){ for(var x = 0, y = options.boxLines; x < y; ++x === true){ for(var x2 = 0, y2 = options.boxesInLine; x2 < y2; ++x2 === true){ esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x + '' + x2) .css({ width: 0, height: 0, opacity: 0, left: ((x2 * esb.boxSliceWidth) + esb.boxSliceWidth / 2) + 'px', top: ((x * esb.boxSliceHeight) + esb.boxSliceHeight / 2) + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x2 * esb.boxSliceWidth) + 'px', top: -(x * esb.boxSliceHeight) + 'px'}) ) .stop() .animate({opacity: 1, width: esb.boxSliceWidth + 'px', height: esb.boxSliceHeight + 'px', left: (x2 * esb.boxSliceWidth) + 'px', top: (x * esb.boxSliceHeight) + 'px'}, options.showSpeed + (x2 * options.delay)) ); } } } if(transition === 15){ var varToLeft = ''; for(var x = 0, y = options.boxLines; x < y; ++x === true){ for(var x2 = 0, y2 = options.boxesInLine; x2 < y2; ++x2 === true){ if((x + x2) % 2 === 0){ varToLeft = esb.boxSliceWidth; } if((x + x2) % 2 === 1){ varToLeft = -esb.boxSliceWidth; } esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x + '' + x2) .css({ width: esb.boxSliceWidth + 'px', height: esb.boxSliceHeight + 'px', opacity: 0, left: ((x2 * esb.boxSliceWidth) + varToLeft) + 'px', top: (x * esb.boxSliceHeight) + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x2 * esb.boxSliceWidth) + 'px', top: -(x * esb.boxSliceHeight) + 'px'}) ) .stop() .animate({opacity: 1, left: (x2 * esb.boxSliceWidth) + 'px'}, options.showSpeed + (x2 * options.delay)) ); } } } if(transition === 16){ var varWidth = ''; for(var x = 0, y = options.boxLines; x < y; ++x === true){ for(var x2 = 0, y2 = options.boxesInLine; x2 < y2; ++x2 === true){ if((x + x2) % 2 === 0){ varWidth = 0; } if((x + x2) % 2 === 1){ varWidth = esb.boxSliceWidth; } esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + ' ' + x + '' + x2) .css({ width: 0, height: esb.boxSliceHeight + 'px', opacity: 0, left: (x2 * esb.boxSliceWidth) + 'px', top: (x * esb.boxSliceHeight) + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x2 * esb.boxSliceWidth) + 'px', top: -(x * esb.boxSliceHeight) + 'px'}) ) .stop() .animate({opacity: .5, width: (varWidth) + 'px'}, (options.showSpeed / 2) + (x2 * options.delay)) .animate({opacity: 1, width: esb.boxSliceWidth + 'px'}, options.showSpeed / 2) ); } } } if(transition === 17){ var varToTop = ''; for(var x = 0, y = options.boxLines; x < y; ++x === true){ for(var x2 = 0, y2 = options.boxesInLine; x2 < y2; ++x2 === true){ if((x + x2) % 2 === 0){ varToTop = esb.boxSliceHeight; } if((x + x2) % 2 === 1){ varToTop = -esb.boxSliceHeight; } esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x + '' + x2) .css({ width: esb.boxSliceWidth + 'px', height: esb.boxSliceHeight + 'px', opacity: 0, left: (x2 * esb.boxSliceWidth) + 'px', top: ((x * esb.boxSliceHeight) + varToTop) + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x2 * esb.boxSliceWidth) + 'px', top: -(x * esb.boxSliceHeight) + 'px'}) ) .stop() .animate({opacity: 1, top: (x * esb.boxSliceHeight) + 'px'}, options.showSpeed + (x2 * options.delay)) ); } } } if(transition === 18){ for(var x = 0, y = options.verticalSlices; x < y; ++x === true){ esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: esb.verticalSliceWidth + 'px', opacity: 0, left: (x * esb.verticalSliceWidth) + 'px', top: 0, height: 0}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: -(x * esb.verticalSliceWidth) + 'px', top: 0}) ) .stop() .animate({opacity: .5, height: (esb.objectHeight / 2) + 'px'}, (options.showSpeed / 2) + (x * Math.random() * options.delay)) .animate({opacity: 1, height: esb.objectHeight + 'px'}, options.showSpeed) ); } } if(transition === 19){ for(var x = 0, y = options.horizontalSlices; x < y; ++x === true){ esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: 0, opacity: 0, left: (esb.objectWidth / 2) + 'px', top: (x * esb.horizontalSliceHeight) + 'px', height: esb.horizontalSliceHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: 0, top: -(x * esb.horizontalSliceHeight) + 'px'}) ) .stop() .animate({opacity: .5, left: 0, width: (esb.objectWidth / 2) + 'px'}, (options.showSpeed / 2) + (x * Math.random() * options.delay)) .animate({opacity: 1, left: 0, width: esb.objectWidth + 'px'}, (options.showSpeed / 2)) ); } } if(transition === 20){ for(var x = 0, y = options.horizontalSlices; x < y; ++x === true){ esb.slicesContainer .append($('') .attr('class', options.sliceClass) .attr('id', options.sliceClass + '' + x) .css({width: 0, opacity: 0, left: (esb.objectWidth / 2) + 'px', top: (x * esb.horizontalSliceHeight) + 'px', height: esb.horizontalSliceHeight + 'px'}) .append($('') .attr('class', options.sliceContentClass) .html(esb.dataToSlice.clone(true).css({display: 'block'})) .css({left: 0, top: -(x * esb.horizontalSliceHeight) + 'px'}) ) .stop() .animate({opacity: .5, width: (esb.objectWidth / 2) + 'px'}, (options.showSpeed / 2) + (x * options.delay)) .animate({left: 0, opacity: 1, width: esb.objectWidth + 'px'}, options.showSpeed / 2) ); } } esb.clearSlicesInterval = setTimeout(function(){ esb.slicesContainer .html(esb.dataToSlice.clone().css({display: 'block'})); if(options.onComplete !== '' && options.onComplete !== undefined){ options.onComplete(); } esb.isMoving = false; esb.slideShowIntervaler(); }, options.showSpeed + (x * options.delay)); delete x, transition; }); }, playPauseToggle: function(){ $('#' + options.contentClass + ' #' + options.preloaderContainerClass) .toggle(); if(true === options.slideShow){ options.slideShow = false; $('#' + options.contentClass + ' .' + options.playClass) .css({display: 'block'}); $('#' + options.contentClass + ' .' + options.pauseClass) .css({display: 'none'}); return false; } if(false === options.slideShow){ options.slideShow = true; $('#' + options.contentClass + ' .' + options.playClass) .css({display: 'none'}); $('#' + options.contentClass + ' .' + options.pauseClass) .css({display: 'block'}); esb.slideShowIntervaler(); return false; } return false; }, init: function(objectClass){ if(esb.domain !== '' && document.domain !== esb.domain){ /* alert('If you want to use it - buy it!'); return; */ } $(document).ready(function(){ if($('body').find($(objectClass)).length <= 0){ return; } if(undefined === options.text[options.language]){ options.language = 'en'; } $('body').find($(objectClass)).each(function(object_index){ esb.objects[object_index] = $(this); var imgAlt = $(this).find('img').attr('alt'); if(imgAlt !== '' && imgAlt !== undefined){ $(this) .append($('') .attr('class', options.thumbCaptionClass) .css({opacity: 0}) .text(imgAlt) ) } if($(this).find('img').length === 1){ $(this).find('img') .css({opacity: options.outOpacity}); $(this) .hover(function(){ $(this).find('img') .stop() .animate({opacity: options.overOpacity}, options.thumbCaptionOpacitySpeed) .end() .find('.' + options.thumbCaptionClass) .stop() .animate({opacity: 1}, options.showThumbCaptionSpeed) }, function(){ $(this).find('img') .stop() .animate({opacity: options.outOpacity}, options.thumbCaptionOpacitySpeed) .end() .find('.' + options.thumbCaptionClass) .stop() .animate({opacity: 0}, options.showThumbCaptionSpeed) }) } $(this) .data('index', object_index) .on('click mousedown', function(e){ if(1 !== e.which && undefined !== e.which){ return false; } esb.openPhoto($(this)); return false; }); }); }); } }; esb.init($(this)); }; })(jQuery);