simplelightbox.min.css 0000644 00000006660 15077052271 0011110 0 ustar 00 .sl-wrapper .sl-close,.sl-wrapper .sl-navigation button{height:44px;line-height:44px;font-family:Arial,Baskerville,monospace}.sl-wrapper .sl-close:focus,.sl-wrapper .sl-navigation button:focus{outline:0}body.hidden-scroll{overflow:hidden}.sl-overlay{position:fixed;left:0;right:0;top:0;bottom:0;background:#fff;opacity:.7;display:none;z-index:1035}.sl-wrapper .sl-close,.sl-wrapper .sl-counter{top:30px;display:none;color:#000;position:fixed}.sl-wrapper{z-index:1040}.sl-wrapper button{border:0;background:0 0;font-size:28px;padding:0;cursor:pointer}.sl-wrapper button:hover{opacity:.7}.sl-wrapper .sl-close{right:30px;z-index:10060;margin-top:-14px;margin-right:-14px;width:44px;font-size:3rem}.sl-wrapper .sl-counter{left:30px;z-index:1060;font-size:1rem}.sl-wrapper .sl-navigation{width:100%;display:none}.sl-wrapper .sl-navigation button{position:fixed;top:50%;margin-top:-22px;width:22px;text-align:center;display:block;z-index:10060;color:#000}.sl-wrapper .sl-navigation button.sl-next{right:5px;font-size:2rem}.sl-wrapper .sl-navigation button.sl-prev{left:5px;font-size:2rem}@media (min-width:35.5em){.sl-wrapper .sl-navigation button{width:44px}.sl-wrapper .sl-navigation button.sl-next{right:10px;font-size:3rem}.sl-wrapper .sl-navigation button.sl-prev{left:10px;font-size:3rem}.sl-wrapper .sl-image img{border:0}}@media (min-width:50em){.sl-wrapper .sl-navigation button{width:44px}.sl-wrapper .sl-navigation button.sl-next{right:20px;font-size:3rem}.sl-wrapper .sl-navigation button.sl-prev{left:20px;font-size:3rem}.sl-wrapper .sl-image img{border:0}}.sl-wrapper .sl-image{position:fixed;-ms-touch-action:none;touch-action:none;z-index:10000}.sl-wrapper .sl-image img{margin:0;padding:0;display:block;border:0;width:100%;height:auto}.sl-wrapper .sl-image iframe{background:#000;border:0}@media (min-width:35.5em){.sl-wrapper .sl-image iframe{border:0}}@media (min-width:50em){.sl-wrapper .sl-image iframe{border:0}}.sl-wrapper .sl-image .sl-caption{display:none;padding:10px;color:#fff;background:rgba(0,0,0,.8);font-size:1rem;position:absolute;bottom:0;left:0;right:0}.sl-wrapper .sl-image .sl-caption.pos-top{bottom:auto;top:0}.sl-wrapper .sl-image .sl-caption.pos-outside{bottom:auto}.sl-wrapper .sl-image .sl-download{display:none;position:absolute;bottom:5px;right:5px;color:#000;z-index:1060}.sl-spinner{display:none;border:5px solid #333;border-radius:40px;height:40px;left:50%;margin:-20px 0 0 -20px;opacity:0;position:fixed;top:50%;width:40px;z-index:1007;-webkit-animation:pulsate 1s ease-out infinite;-moz-animation:pulsate 1s ease-out infinite;-ms-animation:pulsate 1s ease-out infinite;-o-animation:pulsate 1s ease-out infinite;animation:pulsate 1s ease-out infinite}.sl-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.sl-transition{transition:-moz-transform ease .2s;transition:-ms-transform ease .2s;transition:-o-transform ease .2s;transition:-webkit-transform ease .2s;transition:transform ease .2s}@-webkit-keyframes pulsate{0%{transform:scale(.1);opacity:0}50%{opacity:1}100%{transform:scale(1.2);opacity:0}}@keyframes pulsate{0%{transform:scale(.1);opacity:0}50%{opacity:1}100%{transform:scale(1.2);opacity:0}}@-moz-keyframes pulsate{0%{transform:scale(.1);opacity:0}50%{opacity:1}100%{transform:scale(1.2);opacity:0}}@-o-keyframes pulsate{0%{transform:scale(.1);opacity:0}50%{opacity:1}100%{transform:scale(1.2);opacity:0}}@-ms-keyframes pulsate{0%,100%{opacity:0}0%{transform:scale(.1)}50%{opacity:1}100%{transform:scale(1.2)}}
simple-lightbox.js 0000644 00000062015 15077052271 0010223 0 ustar 00 /*!
By André Rinas, www.andrerinas.de
Documentation, www.simplelightbox.de
Available for use under the MIT License
1.16.3
*/
;( function( $, window, document, undefined )
{
'use strict';
$.fn.simpleLightbox = function( options )
{
var options = $.extend({
sourceAttr: 'href',
overlay: true,
spinner: true,
nav: true,
navText: ['‹', '›'],
captions: true,
captionDelay: 0,
captionSelector: 'img',
captionType: 'attr',
captionsData: 'title',
captionPosition: 'bottom',
captionClass: '',
close: true,
closeText: '×',
swipeClose: true,
showCounter: true,
fileExt: 'png|jpg|jpeg|gif',
animationSlide: true,
animationSpeed: 250,
preloading: true,
enableKeyboard: true,
loop: true,
rel: false,
docClose: true,
swipeTolerance: 50,
className: 'simple-lightbox',
widthRatio: 0.8,
heightRatio: 0.9,
scaleImageToRatio: false,
disableRightClick: false,
disableScroll: true,
alertError: true,
alertErrorMessage: 'Image not found, next image will be loaded',
additionalHtml: false,
history: true,
throttleInterval: 0,
doubleTapZoom: 2,
maxZoom: 10,
htmlClass: 'has-lightbox'
}, options);
// global variables
var touchDevice = ( 'ontouchstart' in window ),
pointerEnabled = window.navigator.pointerEnabled || window.navigator.msPointerEnabled,
touched = function( event ){
if( touchDevice ) return true;
if( !pointerEnabled || typeof event === 'undefined' || typeof event.pointerType === 'undefined' ) return false;
if( typeof event.MSPOINTER_TYPE_MOUSE !== 'undefined' ) {
if( event.MSPOINTER_TYPE_MOUSE != event.pointerType ) return true;
}
else {
if( event.pointerType != 'mouse' ) return true;
}
return false;
},
swipeDiff = 0,
swipeYDiff = 0,
curImg = $(),
transPrefix = function(){
var s = document.body || document.documentElement;
s = s.style;
if( s.WebkitTransition === '' ) return '-webkit-';
if( s.MozTransition === '' ) return '-moz-';
if( s.OTransition === '' ) return '-o-';
if( s.transition === '' ) return '';
return false;
},
opened = false,
loaded = [],
getRelated = function(rel, jqObj) {
var $related = jqObj.filter(function () {
return ($(this).attr('rel') === rel);
});
return $related;
},
objects = (options.rel && options.rel !== false) ? getRelated(options.rel, $(this)) : this,
transPrefix = transPrefix(),
globalScrollbarwidth = 0,
canTransisions = (transPrefix !== false) ? true : false,
supportsPushState = ('pushState' in history),
historyhasChanged = false,
historyUpdateTimeout,
winLoc = window.location,
getHash = function(){
return winLoc.hash.substring(1);
},
initialHash = getHash(),
updateHash = function(){
var hash = getHash(),
newHash = 'pid='+(index+1);
var newURL = winLoc.href.split('#')[0] + '#' + newHash;
if(supportsPushState){
history[historyhasChanged ? 'replaceState' : 'pushState']('', document.title, newURL);
}else {
if(historyhasChanged) {
winLoc.replace( newURL );
} else {
winLoc.hash = newHash;
}
}
historyhasChanged = true;
},
resetHash = function() {
if (supportsPushState) {
history.pushState('', document.title, winLoc.pathname + winLoc.search );
} else {
winLoc.hash = '';
}
clearTimeout(historyUpdateTimeout);
},
updateURL = function(){
if(!historyhasChanged) {
updateHash(); // first time
} else {
historyUpdateTimeout = setTimeout(updateHash, 800);
}
},
throttle = function(func, limit) {
var inThrottle;
return function() {
var args = arguments;
var context = this;
if (!inThrottle) {
func.apply(context, args);
inThrottle = true;
setTimeout(function() {
return inThrottle = false;
}, limit);
}
};
},
prefix = 'simplelb',
overlay = $('<div>').addClass('sl-overlay'),
closeBtn = $('<button>').addClass('sl-close').html(options.closeText),
spinner = $('<div>').addClass('sl-spinner').html('<div></div>'),
nav = $('<div>').addClass('sl-navigation').html('<button class="sl-prev">'+options.navText[0]+'</button><button class="sl-next">'+options.navText[1]+'</button>'),
counter = $('<div>').addClass('sl-counter').html('<span class="sl-current"></span>/<span class="sl-total"></span>'),
animating = false,
index = 0,
startIndex = 0,
caption = $('<div>').addClass('sl-caption '+options.captionClass+' pos-'+options.captionPosition),
image = $('<div>').addClass('sl-image'),
wrapper = $('<div>').addClass('sl-wrapper').addClass(options.className),
isValidLink = function( element ){
if(!options.fileExt) return true;
var filEext = /\.([0-9a-z]+)(?=[?#])|(\.)(?:[\w]+)$/gmi;
var testExt = $( element ).attr( options.sourceAttr ).match(filEext);
return testExt && $( element ).prop( 'tagName' ).toLowerCase() == 'a' && ( new RegExp( '\.(' + options.fileExt + ')$', 'i' ) ).test( testExt );
},
setup = function(){
if(options.close) closeBtn.appendTo(wrapper);
if(options.showCounter){
if(objects.length > 1){
counter.appendTo(wrapper);
counter.find('.sl-total').text(objects.length);
}
}
if(options.nav) nav.appendTo(wrapper);
if(options.spinner) spinner.appendTo(wrapper);
},
openImage = function(elem){
elem.trigger($.Event('show.simplelightbox'));
if(options.disableScroll) globalScrollbarwidth = handleScrollbar('hide');
if(options.htmlClass && options.htmlClass != '') $('html').addClass(options.htmlClass);
wrapper.appendTo('body');
image.appendTo(wrapper);
if(options.overlay) overlay.appendTo($('body'));
animating = true;
index = objects.index(elem);
curImg = $( '<img/>' )
.hide()
.attr('src', elem.attr(options.sourceAttr))
.attr('data-scale', 1)
.attr('data-translate-x', 0)
.attr('data-translate-y', 0);
if(loaded.indexOf(elem.attr(options.sourceAttr)) == -1){
loaded.push(elem.attr(options.sourceAttr));
}
image.html('').attr('style','');
curImg.appendTo(image);
addEvents();
overlay.fadeIn('fast');
$('.sl-close').fadeIn('fast');
spinner.show();
nav.fadeIn('fast');
$('.sl-wrapper .sl-counter .sl-current').text(index +1);
counter.fadeIn('fast');
adjustImage();
if(options.preloading) preload();
setTimeout( function(){ elem.trigger($.Event('shown.simplelightbox')); } ,options.animationSpeed);
},
adjustImage = function(dir){
if(!curImg.length) return;
var tmpImage = new Image(),
windowWidth = window.innerWidth * options.widthRatio,
windowHeight = window.innerHeight * options.heightRatio;
tmpImage.src = curImg.attr( 'src' );
curImg.data('scale',1);
curImg.data('translate-x',0);
curImg.data('translate-y',0);
zoomPanElement(0,0,1);
$(tmpImage).on('error',function(ev){
//no image was found
objects.eq(index).trigger($.Event('error.simplelightbox'));
animating = false;
opened = true;
spinner.hide();
var dirDefinined = (dir == 1 || dir == -1);
if(startIndex === index && dirDefinined){
close();
return;
}
if(options.alertError){
alert(options.alertErrorMessage);
}
if(dirDefinined){
loadImage(dir);
} else {
loadImage(1);
}
return;
});
tmpImage.onload = function() {
if (typeof dir !== 'undefined') {
objects.eq(index)
.trigger($.Event('changed.simplelightbox'))
.trigger($.Event( (dir===1?'nextDone':'prevDone')+'.simplelightbox'));
}
// history
if(options.history){
updateURL();
}
if(loaded.indexOf(curImg.attr( 'src' )) == -1){
loaded.push(curImg.attr( 'src' ));
}
var imageWidth = tmpImage.width,
imageHeight = tmpImage.height;
if( options.scaleImageToRatio || imageWidth > windowWidth || imageHeight > windowHeight ){
var ratio = imageWidth / imageHeight > windowWidth / windowHeight ? imageWidth / windowWidth : imageHeight / windowHeight;
imageWidth /= ratio;
imageHeight /= ratio;
}
$('.sl-image').css({
'top': ( window.innerHeight - imageHeight ) / 2 + 'px',
'left': ( window.innerWidth - imageWidth - globalScrollbarwidth)/ 2 + 'px',
'width': imageWidth + 'px',
'height': imageHeight + 'px'
});
spinner.hide();
curImg
.fadeIn('fast');
opened = true;
var cSel = (options.captionSelector == 'self') ? objects.eq(index) : objects.eq(index).find(options.captionSelector);
var captionText;
if(options.captionType == 'data'){
captionText = cSel.data(options.captionsData);
} else if(options.captionType == 'text'){
captionText = cSel.html();
} else {
captionText = cSel.prop(options.captionsData);
}
if(!options.loop) {
if(index === 0){ $('.sl-prev').hide();}
if(index >= objects.length -1) {$('.sl-next').hide();}
if(index > 0){ $('.sl-prev').show(); }
if(index < objects.length -1){ $('.sl-next').show(); }
}
if(objects.length == 1) $('.sl-prev, .sl-next').hide();
if(dir == 1 || dir == -1){
var css = { 'opacity': 1.0 };
if( options.animationSlide ) {
if( canTransisions ) {
slide(0, 100 * dir + 'px');
setTimeout( function(){ slide( options.animationSpeed / 1000, 0 + 'px'); }, 50 );
}
else {
css.left = parseInt( $('.sl-image').css( 'left' ) ) + 100 * dir + 'px';
}
}
$('.sl-image').animate( css, options.animationSpeed, function(){
animating = false;
setCaption(captionText, imageWidth);
});
} else {
animating = false;
setCaption(captionText, imageWidth);
}
if(options.additionalHtml && $('.sl-additional-html').length === 0){
$('<div>').html(options.additionalHtml).addClass('sl-additional-html').appendTo($('.sl-image'));
}
};
},
setCaption = function(captiontext, imageWidth){
if(captiontext !== '' && typeof captiontext !== "undefined" && options.captions){
caption.html(captiontext).css({'width': imageWidth + 'px'}).hide().appendTo($('.sl-image')).delay(options.captionDelay).fadeIn('fast');
}
},
slide = function(speed, pos){
var styles = {};
styles[transPrefix + 'transform'] = 'translateX(' + pos + ')';
styles[transPrefix + 'transition'] = transPrefix + 'transform ' + speed + 's linear';
$('.sl-image').css(styles);
},
zoomPanElement = function(targetOffsetX, targetOffsetY, targetScale) {
var styles = {};
styles[transPrefix + 'transform'] = 'translate(' + targetOffsetX + ',' + targetOffsetY+ ') scale('+targetScale+')';
curImg.css(styles);
},
minMax = function(value, min, max) {
return (value < min) ? min : (value > max) ? max : value;
},
setZoomData = function(initialScale,targetOffsetX,targetOffsetY) {
curImg.data('scale',initialScale);
curImg.data('translate-x',targetOffsetX);
curImg.data('translate-y',targetOffsetY);
},
addEvents = function(){
// resize/responsive
$( window ).on( 'resize.'+prefix, adjustImage );
// close lightbox on close btn
$( document ).on('click.'+prefix+ ' touchstart.'+prefix, '.sl-close', function(e){
e.preventDefault();
if(opened){ close();}
});
if(options.history){
setTimeout(function() {
$(window).on('hashchange.'+prefix,function(){
if(opened){
if(getHash() === initialHash) {
close();
return;
}
}
});
}, 40);
}
// nav-buttons
nav.on('click.'+prefix, 'button', throttle(function(e){
e.preventDefault();
swipeDiff = 0;
loadImage( $(this).hasClass('sl-next') ? 1 : -1 );
}, options.throttleInterval));
// touch helpers
var swipeStart = 0,
swipeEnd = 0,
swipeYStart = 0,
swipeYEnd = 0,
zoomed = false,
mousedown = false,
imageLeft = 0,
containerHeight,
containerWidth,
containerOffsetX,
containerOffsetY,
imgHeight,
imgWidth,
capture = false,
initialOffsetX,
initialOffsetY,
initialPointerOffsetX,
initialPointerOffsetY,
initialPointerOffsetX2,
initialPointerOffsetY2,
initialScale = minMax(1, 1, options.maxZoom),
initialPinchDistance,
pointerOffsetX,
pointerOffsetY,
pointerOffsetX2,
pointerOffsetY2,
targetOffsetX,
targetOffsetY,
targetScale,
pinchOffsetX,
pinchOffsetY,
limitOffsetX,
limitOffsetY,
scaleDifference,
targetPinchDistance,
touchCount,
doubleTapped = false,
touchmoveCount = 0;
image
.on( 'touchstart.'+prefix+' mousedown.'+prefix, function(e)
{
if (e.target.tagName === 'A' && e.type == 'touchstart') {
return true;
}
e = e.originalEvent;
if(e.type == 'mousedown') {
} else {
touchCount = e.touches.length;
initialPointerOffsetX = e.touches[0].clientX;
initialPointerOffsetY = e.touches[0].clientY;
containerHeight = image.height();
containerWidth = image.width();
imgHeight = curImg.height();
imgWidth = curImg.width();
containerOffsetX = image.position().left;
containerOffsetY = image.position().top;
if (touchCount === 1) /* Single touch */ {
if(!doubleTapped) {
doubleTapped = true;
setTimeout(function(){
doubleTapped = false;
}, 300);
} else {
curImg.addClass('sl-transition');
if(!zoomed) {
initialScale = options.doubleTapZoom;
setZoomData(0,0, initialScale);
zoomPanElement(0 + "px", 0 + "px", initialScale);
$('.sl-caption').fadeOut(200);
zoomed = true;
} else {
initialScale = 1;
setZoomData(0,0,initialScale);
zoomPanElement(0 + "px", 0 + "px", initialScale);
zoomed = false;
}
setTimeout(function(){
curImg.removeClass('sl-transition');
}, 200);
return false;
}
initialOffsetX = parseFloat(curImg.data('translate-x'));
initialOffsetY = parseFloat(curImg.data('translate-y'));
}
else if (touchCount === 2) /* Pinch */ {
initialPointerOffsetX2 = e.touches[1].clientX;
initialPointerOffsetY2 = e.touches[1].clientY;
initialOffsetX = parseFloat(curImg.data('translate-x'));
initialOffsetY = parseFloat(curImg.data('translate-y'));
pinchOffsetX = (initialPointerOffsetX + initialPointerOffsetX2) / 2;
pinchOffsetY = (initialPointerOffsetY + initialPointerOffsetY2) / 2;
initialPinchDistance = Math.sqrt(((initialPointerOffsetX - initialPointerOffsetX2) * (initialPointerOffsetX - initialPointerOffsetX2)) + ((initialPointerOffsetY - initialPointerOffsetY2) * (initialPointerOffsetY - initialPointerOffsetY2)));
}
capture = true;
}
if(mousedown) return true;
if( canTransisions ) imageLeft = parseInt( image.css( 'left' ) );
mousedown = true;
swipeDiff = 0;
swipeYDiff = 0;
swipeStart = e.pageX || e.touches[ 0 ].pageX;
swipeYStart = e.pageY || e.touches[ 0 ].pageY;
return false;
})
.on( 'touchmove.'+prefix+' mousemove.'+prefix+' MSPointerMove', function(e)
{
if(!mousedown) return true;
e.preventDefault();
e = e.originalEvent;
/* Initialize helpers */
if(e.type == 'touchmove') {
if(capture === false) return false;
pointerOffsetX = e.touches[0].clientX;
pointerOffsetY = e.touches[0].clientY;
touchCount = e.touches.length;
touchmoveCount++;
if (touchCount > 1) /* Pinch */ {
pointerOffsetX2 = e.touches[1].clientX;
pointerOffsetY2 = e.touches[1].clientY;
targetPinchDistance = Math.sqrt(((pointerOffsetX - pointerOffsetX2) * (pointerOffsetX - pointerOffsetX2)) + ((pointerOffsetY - pointerOffsetY2) * (pointerOffsetY - pointerOffsetY2)));
if (initialPinchDistance === null) {
initialPinchDistance = targetPinchDistance;
}
if (Math.abs(initialPinchDistance - targetPinchDistance) >= 1) {
/* Initialize helpers */
targetScale = minMax(targetPinchDistance / initialPinchDistance * initialScale, 1, options.maxZoom);
limitOffsetX = ((imgWidth * targetScale) - containerWidth) / 2;
limitOffsetY = ((imgHeight * targetScale) - containerHeight) / 2;
scaleDifference = targetScale - initialScale;
targetOffsetX = (imgWidth * targetScale) <= containerWidth ? 0: minMax(initialOffsetX - ((((((pinchOffsetX - containerOffsetX) - (containerWidth / 2)) - initialOffsetX) / (targetScale - scaleDifference))) * scaleDifference), limitOffsetX * (-1), limitOffsetX);
targetOffsetY = (imgHeight * targetScale) <= containerHeight ? 0 : minMax(initialOffsetY - ((((((pinchOffsetY - containerOffsetY) - (containerHeight / 2)) - initialOffsetY) / (targetScale - scaleDifference))) * scaleDifference), limitOffsetY * (-1), limitOffsetY);
zoomPanElement(targetOffsetX + "px", targetOffsetY + "px", targetScale);
if (targetScale > 1) {
zoomed = true;
$('.sl-caption').fadeOut(200);
}
initialPinchDistance = targetPinchDistance;
initialScale = targetScale;
initialOffsetX = targetOffsetX;
initialOffsetY = targetOffsetY;
}
} else {
targetScale = initialScale;
limitOffsetX = ((imgWidth * targetScale) - containerWidth) / 2;
limitOffsetY = ((imgHeight * targetScale) - containerHeight) / 2;
targetOffsetX = (imgWidth * targetScale) <= containerWidth ? 0 : minMax(pointerOffsetX - (initialPointerOffsetX - initialOffsetX), limitOffsetX * (-1), limitOffsetX);
targetOffsetY = (imgHeight * targetScale) <= containerHeight ? 0 : minMax(pointerOffsetY - (initialPointerOffsetY - initialOffsetY), limitOffsetY * (-1), limitOffsetY);
if (Math.abs(targetOffsetX) === Math.abs(limitOffsetX)) {
initialOffsetX = targetOffsetX;
initialPointerOffsetX = pointerOffsetX;
}
if (Math.abs(targetOffsetY) === Math.abs(limitOffsetY)) {
initialOffsetY = targetOffsetY;
initialPointerOffsetY = pointerOffsetY;
}
setZoomData(initialScale,targetOffsetX,targetOffsetY);
zoomPanElement(targetOffsetX + "px", targetOffsetY + "px", targetScale);
}
}
if(!zoomed) {
swipeEnd = e.pageX || e.touches[ 0 ].pageX;
swipeYEnd = e.pageY || e.touches[ 0 ].pageY;
swipeDiff = swipeStart - swipeEnd;
swipeYDiff = swipeYStart - swipeYEnd;
if( options.animationSlide ) {
if( canTransisions ) slide( 0, -swipeDiff + 'px' );
else image.css( 'left', imageLeft - swipeDiff + 'px' );
}
}
})
.on( 'touchend.'+prefix+' mouseup.'+prefix+' touchcancel.'+prefix+' mouseleave.'+prefix+' pointerup pointercancel MSPointerUp MSPointerCancel',function(e)
{
e = e.originalEvent;
if(touchDevice && e.type =='touchend') {
touchCount = e.touches.length;
if (touchCount === 0) /* No touch */ {
/* Set attributes */
setZoomData(initialScale,targetOffsetX,targetOffsetY);
if(initialScale == 1) {
zoomed = false;
$('.sl-caption').fadeIn(200);
}
initialPinchDistance = null;
capture = false;
} else if (touchCount === 1) /* Single touch */ {
initialPointerOffsetX = e.touches[0].clientX;
initialPointerOffsetY = e.touches[0].clientY;
} else if (touchCount > 1) /* Pinch */ {
initialPinchDistance = null;
}
}
if(mousedown){
mousedown = false;
var possibleDir = true;
if(!options.loop) {
if(index === 0 && swipeDiff < 0){ possibleDir = false; }
if(index >= objects.length -1 && swipeDiff > 0) { possibleDir = false; }
}
if( Math.abs( swipeDiff ) > options.swipeTolerance && possibleDir ) {
loadImage( swipeDiff > 0 ? 1 : -1 );
}
else if( options.animationSlide )
{
if( canTransisions ) slide( options.animationSpeed / 1000, 0 + 'px' );
else image.animate({ 'left': imageLeft + 'px' }, options.animationSpeed / 2 );
}
if( options.swipeClose && Math.abs(swipeYDiff) > 50 && Math.abs( swipeDiff ) < options.swipeTolerance) {
close();
}
}
});
},
removeEvents = function(){
nav.off('click', 'button');
$( document ).off('click.'+prefix, '.sl-close');
$( window ).off( 'resize.'+prefix);
$( window ).off( 'hashchange.'+prefix);
},
preload = function(){
var next = (index+1 < 0) ? objects.length -1: (index+1 >= objects.length -1) ? 0 : index+1,
prev = (index-1 < 0) ? objects.length -1: (index-1 >= objects.length -1) ? 0 : index-1;
$( '<img />' ).attr( 'src', objects.eq(next).attr( options.sourceAttr ) ).on('load', function(){
if(loaded.indexOf($(this).attr('src')) == -1){
loaded.push($(this).attr('src'));
}
objects.eq(index).trigger($.Event('nextImageLoaded.simplelightbox'));
});
$( '<img />' ).attr( 'src', objects.eq(prev).attr( options.sourceAttr ) ).on('load', function(){
if(loaded.indexOf($(this).attr('src')) == -1){
loaded.push($(this).attr('src'));
}
objects.eq(index).trigger($.Event('prevImageLoaded.simplelightbox'));
});
},
loadImage = function(dir){
objects.eq(index)
.trigger($.Event('change.simplelightbox'))
.trigger($.Event( (dir===1?'next':'prev')+'.simplelightbox'));
var newIndex = index + dir;
if(animating || (newIndex < 0 || newIndex >= objects.length) && options.loop === false ) return;
index = (newIndex < 0) ? objects.length -1: (newIndex > objects.length -1) ? 0 : newIndex;
$('.sl-wrapper .sl-counter .sl-current').text(index +1);
var css = { 'opacity': 0 };
if( options.animationSlide ) {
if( canTransisions ) slide(options.animationSpeed / 1000, ( -100 * dir ) - swipeDiff + 'px');
else css.left = parseInt( $('.sl-image').css( 'left' ) ) + -100 * dir + 'px';
}
$('.sl-image').animate( css, options.animationSpeed, function(){
setTimeout( function(){
// fadeout old image
var elem = objects.eq(index);
curImg
.attr('src', elem.attr(options.sourceAttr));
if(loaded.indexOf(elem.attr(options.sourceAttr)) == -1){
spinner.show();
}
$('.sl-caption').remove();
adjustImage(dir);
if(options.preloading) preload();
}, 100);
});
},
close = function(){
if(animating) return;
var elem = objects.eq(index),
triggered = false;
elem.trigger($.Event('close.simplelightbox'));
if(options.history){
resetHash();
}
$('.sl-image img, .sl-overlay, .sl-close, .sl-navigation, .sl-image .sl-caption, .sl-counter').fadeOut('fast', function(){
if(options.disableScroll) handleScrollbar('show');
if(options.htmlClass && options.htmlClass != '') $('html').removeClass(options.htmlClass);
$('.sl-wrapper, .sl-overlay').remove();
removeEvents();
if(!triggered) elem.trigger($.Event('closed.simplelightbox'));
triggered = true;
});
curImg = $();
opened = false;
animating = false;
},
handleScrollbar = function(type){
var scrollbarWidth = 0;
if(type == 'hide'){
var fullWindowWidth = window.innerWidth;
if (!fullWindowWidth) {
var documentElementRect = document.documentElement.getBoundingClientRect();
fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left);
}
if(document.body.clientWidth < fullWindowWidth){
var scrollDiv = document.createElement('div'),
padding = parseInt($('body').css('padding-right'),10);
scrollDiv.className = 'sl-scrollbar-measure';
$('body').append(scrollDiv);
scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
$(document.body)[0].removeChild(scrollDiv);
$('body').data('padding',padding);
if(scrollbarWidth > 0){
$('body').addClass('hidden-scroll').css({'padding-right':padding+scrollbarWidth});
}
}
} else {
$('body').removeClass('hidden-scroll').css({'padding-right':$('body').data('padding')});
}
return scrollbarWidth;
};
// events
setup();
// open lightbox
objects.on( 'click.'+prefix, function( e ){
if(isValidLink(this)){
e.preventDefault();
if(animating) return false;
var elem = $(this);
startIndex = objects.index(elem);
openImage(elem);
}
});
// close on click on doc
$( document ).on('click.'+prefix+ ' touchstart.'+prefix, function(e){
if(opened){
if((options.docClose && $(e.target).closest('.sl-image').length === 0 && $(e.target).closest('.sl-navigation').length === 0)){
close();
}
}
});
// disable rightclick
if(options.disableRightClick){
$( document ).on('contextmenu', '.sl-image img', function(e){
return false;
});
}
// keyboard-control
if( options.enableKeyboard ){
$( document ).on( 'keyup.'+prefix, throttle(function( e ){
swipeDiff = 0;
// keyboard control only if lightbox is open
var key = e.keyCode;
if(animating && key == 27) {
curImg.attr('src', '');
animating = false;
close();
}
if(opened){
e.preventDefault();
if( key == 27 ) {
close();
}
if( key == 37 || e.keyCode == 39 ) {
loadImage( e.keyCode == 39 ? 1 : -1 );
}
}
}, options.throttleInterval));
}
// Public methods
this.open = function(elem){
elem = elem || $(this[0]);
startIndex = objects.index(elem);
openImage(elem);
};
this.next = function(){
loadImage( 1 );
};
this.prev = function(){
loadImage( -1 );
};
this.close = function(){
close();
};
this.destroy = function(){
$( document ).off('click.'+prefix).off('keyup.'+prefix);
close();
$('.sl-overlay, .sl-wrapper').remove();
this.off('click');
};
this.refresh = function(){
this.destroy();
$(this).simpleLightbox(options);
};
return this;
};
})( jQuery, window, document );
simplelightbox.css 0000644 00000012055 15077052271 0010321 0 ustar 00 body.hidden-scroll {
overflow: hidden; }
.sl-overlay {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: #fff;
opacity: 0.7;
display: none;
z-index: 1035; }
.sl-wrapper {
z-index: 1040; }
.sl-wrapper button {
border: 0 none;
background: transparent;
font-size: 28px;
padding: 0;
cursor: pointer; }
.sl-wrapper button:hover {
opacity: 0.7; }
.sl-wrapper .sl-close {
display: none;
position: fixed;
right: 30px;
top: 30px;
z-index: 10060;
margin-top: -14px;
margin-right: -14px;
height: 44px;
width: 44px;
line-height: 44px;
font-family: Arial, Baskerville, monospace;
color: #000;
font-size: 3rem; }
.sl-wrapper .sl-close:focus {
outline: none; }
.sl-wrapper .sl-counter {
display: none;
position: fixed;
top: 30px;
left: 30px;
z-index: 1060;
color: #000;
font-size: 1rem; }
.sl-wrapper .sl-navigation {
width: 100%;
display: none; }
.sl-wrapper .sl-navigation button {
position: fixed;
top: 50%;
margin-top: -22px;
height: 44px;
width: 22px;
line-height: 44px;
text-align: center;
display: block;
z-index: 10060;
font-family: Arial, Baskerville, monospace;
color: #000; }
.sl-wrapper .sl-navigation button.sl-next {
right: 5px;
font-size: 2rem; }
.sl-wrapper .sl-navigation button.sl-prev {
left: 5px;
font-size: 2rem; }
.sl-wrapper .sl-navigation button:focus {
outline: none; }
@media (min-width: 35.5em) {
.sl-wrapper .sl-navigation button {
width: 44px; }
.sl-wrapper .sl-navigation button.sl-next {
right: 10px;
font-size: 3rem; }
.sl-wrapper .sl-navigation button.sl-prev {
left: 10px;
font-size: 3rem; } }
@media (min-width: 50em) {
.sl-wrapper .sl-navigation button {
width: 44px; }
.sl-wrapper .sl-navigation button.sl-next {
right: 20px;
font-size: 3rem; }
.sl-wrapper .sl-navigation button.sl-prev {
left: 20px;
font-size: 3rem; } }
.sl-wrapper .sl-image {
position: fixed;
-ms-touch-action: none;
touch-action: none;
z-index: 10000; }
.sl-wrapper .sl-image img {
margin: 0;
padding: 0;
display: block;
border: 0 none;
width: 100%;
height: auto; }
@media (min-width: 35.5em) {
.sl-wrapper .sl-image img {
border: 0 none; } }
@media (min-width: 50em) {
.sl-wrapper .sl-image img {
border: 0 none; } }
.sl-wrapper .sl-image iframe {
background: #000;
border: 0 none; }
@media (min-width: 35.5em) {
.sl-wrapper .sl-image iframe {
border: 0 none; } }
@media (min-width: 50em) {
.sl-wrapper .sl-image iframe {
border: 0 none; } }
.sl-wrapper .sl-image .sl-caption {
display: none;
padding: 10px;
color: #fff;
background: rgba(0, 0, 0, 0.8);
font-size: 1rem;
position: absolute;
bottom: 0;
left: 0;
right: 0; }
.sl-wrapper .sl-image .sl-caption.pos-top {
bottom: auto;
top: 0; }
.sl-wrapper .sl-image .sl-caption.pos-outside {
bottom: auto; }
.sl-wrapper .sl-image .sl-download {
display: none;
position: absolute;
bottom: 5px;
right: 5px;
color: #000;
z-index: 1060; }
.sl-spinner {
display: none;
border: 5px solid #333;
border-radius: 40px;
height: 40px;
left: 50%;
margin: -20px 0 0 -20px;
opacity: 0;
position: fixed;
top: 50%;
width: 40px;
z-index: 1007;
-webkit-animation: pulsate 1s ease-out infinite;
-moz-animation: pulsate 1s ease-out infinite;
-ms-animation: pulsate 1s ease-out infinite;
-o-animation: pulsate 1s ease-out infinite;
animation: pulsate 1s ease-out infinite; }
.sl-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll; }
.sl-transition {
transition: -moz-transform ease 200ms;
transition: -ms-transform ease 200ms;
transition: -o-transform ease 200ms;
transition: -webkit-transform ease 200ms;
transition: transform ease 200ms; }
@-webkit-keyframes pulsate {
0% {
transform: scale(0.1);
opacity: 0.0; }
50% {
opacity: 1; }
100% {
transform: scale(1.2);
opacity: 0; } }
@keyframes pulsate {
0% {
transform: scale(0.1);
opacity: 0.0; }
50% {
opacity: 1; }
100% {
transform: scale(1.2);
opacity: 0; } }
@-moz-keyframes pulsate {
0% {
transform: scale(0.1);
opacity: 0.0; }
50% {
opacity: 1; }
100% {
transform: scale(1.2);
opacity: 0; } }
@-o-keyframes pulsate {
0% {
transform: scale(0.1);
opacity: 0.0; }
50% {
opacity: 1; }
100% {
transform: scale(1.2);
opacity: 0; } }
@-ms-keyframes pulsate {
0% {
transform: scale(0.1);
opacity: 0.0; }
50% {
opacity: 1; }
100% {
transform: scale(1.2);
opacity: 0; } }
simple-lightbox.min.js 0000644 00000026724 15077052271 0011014 0 ustar 00 /*
By André Rinas, www.andrerinas.de
Documentation, www.simplelightbox.de
Available for use under the MIT License
1.16.3
*/
!function(ot,lt,rt,t){"use strict";ot.fn.simpleLightbox=function(z){z=ot.extend({sourceAttr:"href",overlay:!0,spinner:!0,nav:!0,navText:["‹","›"],captions:!0,captionDelay:0,captionSelector:"img",captionType:"attr",captionsData:"title",captionPosition:"bottom",captionClass:"",close:!0,closeText:"×",swipeClose:!0,showCounter:!0,fileExt:"png|jpg|jpeg|gif",animationSlide:!0,animationSpeed:250,preloading:!0,enableKeyboard:!0,loop:!0,rel:!1,docClose:!0,swipeTolerance:50,className:"simple-lightbox",widthRatio:.8,heightRatio:.9,scaleImageToRatio:!1,disableRightClick:!1,disableScroll:!0,alertError:!0,alertErrorMessage:"Image not found, next image will be loaded",additionalHtml:!1,history:!0,throttleInterval:0,doubleTapZoom:2,maxZoom:10,htmlClass:"has-lightbox"},z);var h,t,H="ontouchstart"in lt,L=(lt.navigator.pointerEnabled||lt.navigator.msPointerEnabled,0),N=0,Z=ot(),i=function(){var t=rt.body||rt.documentElement;return""===(t=t.style).WebkitTransition?"-webkit-":""===t.MozTransition?"-moz-":""===t.OTransition?"-o-":""===t.transition&&""},F=!1,d=[],j=z.rel&&!1!==z.rel?(t=z.rel,ot(this).filter(function(){return ot(this).attr("rel")===t})):this,p=(i=i(),0),K=!1!==i,a="pushState"in history,u=!1,n=lt.location,$=function(){return n.hash.substring(1)},B=$(),g=function(){$();var t="pid="+(J+1),e=n.href.split("#")[0]+"#"+t;a?history[u?"replaceState":"pushState"]("",rt.title,e):u?n.replace(e):n.hash=t,u=!0},Q=function(e,a){var n;return function(){var t=arguments;n||(e.apply(this,t),n=!0,setTimeout(function(){return n=!1},a))}},U="simplelb",e=ot("<div>").addClass("sl-overlay"),s=ot("<button>").addClass("sl-close").html(z.closeText),f=ot("<div>").addClass("sl-spinner").html("<div></div>"),G=ot("<div>").addClass("sl-navigation").html('<button class="sl-prev">'+z.navText[0]+'</button><button class="sl-next">'+z.navText[1]+"</button>"),o=ot("<div>").addClass("sl-counter").html('<span class="sl-current"></span>/<span class="sl-total"></span>'),m=!1,J=0,v=0,l=ot("<div>").addClass("sl-caption "+z.captionClass+" pos-"+z.captionPosition),V=ot("<div>").addClass("sl-image"),r=ot("<div>").addClass("sl-wrapper").addClass(z.className),c=function(t){t.trigger(ot.Event("show.simplelightbox")),z.disableScroll&&(p=C("hide")),z.htmlClass&&""!=z.htmlClass&&ot("html").addClass(z.htmlClass),r.appendTo("body"),V.appendTo(r),z.overlay&&e.appendTo(ot("body")),m=!0,J=j.index(t),Z=ot("<img/>").hide().attr("src",t.attr(z.sourceAttr)).attr("data-scale",1).attr("data-translate-x",0).attr("data-translate-y",0),-1==d.indexOf(t.attr(z.sourceAttr))&&d.push(t.attr(z.sourceAttr)),V.html("").attr("style",""),Z.appendTo(V),b(),e.fadeIn("fast"),ot(".sl-close").fadeIn("fast"),f.show(),G.fadeIn("fast"),ot(".sl-wrapper .sl-counter .sl-current").text(J+1),o.fadeIn("fast"),_(),z.preloading&&y(),setTimeout(function(){t.trigger(ot.Event("shown.simplelightbox"))},z.animationSpeed)},_=function(o){if(Z.length){var l=new Image,r=lt.innerWidth*z.widthRatio,c=lt.innerHeight*z.heightRatio;l.src=Z.attr("src"),Z.data("scale",1),Z.data("translate-x",0),Z.data("translate-y",0),et(0,0,1),ot(l).on("error",function(t){j.eq(J).trigger(ot.Event("error.simplelightbox")),F=!(m=!1),f.hide();var e=1==o||-1==o;v===J&&e?st():(z.alertError&&alert(z.alertErrorMessage),it(e?o:1))}),l.onload=function(){void 0!==o&&j.eq(J).trigger(ot.Event("changed.simplelightbox")).trigger(ot.Event((1===o?"nextDone":"prevDone")+".simplelightbox")),z.history&&(u?h=setTimeout(g,800):g()),-1==d.indexOf(Z.attr("src"))&&d.push(Z.attr("src"));var t=l.width,e=l.height;if(z.scaleImageToRatio||r<t||c<e){var a=r/c<t/e?t/r:e/c;t/=a,e/=a}ot(".sl-image").css({top:(lt.innerHeight-e)/2+"px",left:(lt.innerWidth-t-p)/2+"px",width:t+"px",height:e+"px"}),f.hide(),Z.fadeIn("fast"),F=!0;var n,i="self"==z.captionSelector?j.eq(J):j.eq(J).find(z.captionSelector);if(n="data"==z.captionType?i.data(z.captionsData):"text"==z.captionType?i.html():i.prop(z.captionsData),z.loop||(0===J&&ot(".sl-prev").hide(),J>=j.length-1&&ot(".sl-next").hide(),0<J&&ot(".sl-prev").show(),J<j.length-1&&ot(".sl-next").show()),1==j.length&&ot(".sl-prev, .sl-next").hide(),1==o||-1==o){var s={opacity:1};z.animationSlide&&(K?(tt(0,100*o+"px"),setTimeout(function(){tt(z.animationSpeed/1e3,"0px")},50)):s.left=parseInt(ot(".sl-image").css("left"))+100*o+"px"),ot(".sl-image").animate(s,z.animationSpeed,function(){m=!1,x(n,t)})}else m=!1,x(n,t);z.additionalHtml&&0===ot(".sl-additional-html").length&&ot("<div>").html(z.additionalHtml).addClass("sl-additional-html").appendTo(ot(".sl-image"))}}},x=function(t,e){""!==t&&void 0!==t&&z.captions&&l.html(t).css({width:e+"px"}).hide().appendTo(ot(".sl-image")).delay(z.captionDelay).fadeIn("fast")},tt=function(t,e){var a={};a[i+"transform"]="translateX("+e+")",a[i+"transition"]=i+"transform "+t+"s linear",ot(".sl-image").css(a)},et=function(t,e,a){var n={};n[i+"transform"]="translate("+t+","+e+") scale("+a+")",Z.css(n)},at=function(t,e,a){return t<e?e:a<t?a:t},nt=function(t,e,a){Z.data("scale",t),Z.data("translate-x",e),Z.data("translate-y",a)},b=function(){ot(lt).on("resize."+U,_),ot(rt).on("click."+U+" touchstart."+U,".sl-close",function(t){t.preventDefault(),F&&st()}),z.history&&setTimeout(function(){ot(lt).on("hashchange."+U,function(){F&&$()===B&&st()})},40),G.on("click."+U,"button",Q(function(t){t.preventDefault(),L=0,it(ot(this).hasClass("sl-next")?1:-1)},z.throttleInterval));var e,a,n,i,s,o,l,r,c,h,d,p,u,g,f,m,v,x,b,y,C,T,w,E,S,I,M,k=0,q=0,D=0,A=0,R=!1,X=!1,O=0,Y=!1,W=at(1,1,z.maxZoom),P=!1;V.on("touchstart."+U+" mousedown."+U,function(t){if("A"===t.target.tagName&&"touchstart"==t.type)return!0;if("mousedown"==(t=t.originalEvent).type);else{if(M=t.touches.length,c=t.touches[0].clientX,h=t.touches[0].clientY,e=V.height(),a=V.width(),s=Z.height(),o=Z.width(),n=V.position().left,i=V.position().top,1===M){if(P)return Z.addClass("sl-transition"),R=R?(nt(0,0,W=1),et("0px","0px",W),!1):(W=z.doubleTapZoom,nt(0,0,W),et("0px","0px",W),ot(".sl-caption").fadeOut(200),!0),setTimeout(function(){Z.removeClass("sl-transition")},200),!1;P=!0,setTimeout(function(){P=!1},300),l=parseFloat(Z.data("translate-x")),r=parseFloat(Z.data("translate-y"))}else 2===M&&(d=t.touches[1].clientX,p=t.touches[1].clientY,l=parseFloat(Z.data("translate-x")),r=parseFloat(Z.data("translate-y")),C=(c+d)/2,T=(h+p)/2,u=Math.sqrt((c-d)*(c-d)+(h-p)*(h-p)));Y=!0}return!!X||(K&&(O=parseInt(V.css("left"))),X=!0,N=L=0,k=t.pageX||t.touches[0].pageX,D=t.pageY||t.touches[0].pageY,!1)}).on("touchmove."+U+" mousemove."+U+" MSPointerMove",function(t){if(!X)return!0;if(t.preventDefault(),"touchmove"==(t=t.originalEvent).type){if(!1===Y)return!1;g=t.touches[0].clientX,f=t.touches[0].clientY,M=t.touches.length,0,1<M?(m=t.touches[1].clientX,v=t.touches[1].clientY,I=Math.sqrt((g-m)*(g-m)+(f-v)*(f-v)),null===u&&(u=I),1<=Math.abs(u-I)&&(y=at(I/u*W,1,z.maxZoom),w=(o*y-a)/2,E=(s*y-e)/2,S=y-W,x=o*y<=a?0:at(l-(C-n-a/2-l)/(y-S)*S,-1*w,w),b=s*y<=e?0:at(r-(T-i-e/2-r)/(y-S)*S,-1*E,E),et(x+"px",b+"px",y),1<y&&(R=!0,ot(".sl-caption").fadeOut(200)),u=I,W=y,l=x,r=b)):(w=(o*(y=W)-a)/2,E=(s*y-e)/2,x=o*y<=a?0:at(g-(c-l),-1*w,w),b=s*y<=e?0:at(f-(h-r),-1*E,E),Math.abs(x)===Math.abs(w)&&(l=x,c=g),Math.abs(b)===Math.abs(E)&&(r=b,h=f),nt(W,x,b),et(x+"px",b+"px",y))}R||(q=t.pageX||t.touches[0].pageX,A=t.pageY||t.touches[0].pageY,L=k-q,N=D-A,z.animationSlide&&(K?tt(0,-L+"px"):V.css("left",O-L+"px")))}).on("touchend."+U+" mouseup."+U+" touchcancel."+U+" mouseleave."+U+" pointerup pointercancel MSPointerUp MSPointerCancel",function(t){if(t=t.originalEvent,H&&"touchend"==t.type&&(0===(M=t.touches.length)?(nt(W,x,b),1==W&&(R=!1,ot(".sl-caption").fadeIn(200)),u=null,Y=!1):1===M?(c=t.touches[0].clientX,h=t.touches[0].clientY):1<M&&(u=null)),X){var e=!(X=!1);z.loop||(0===J&&L<0&&(e=!1),J>=j.length-1&&0<L&&(e=!1)),Math.abs(L)>z.swipeTolerance&&e?it(0<L?1:-1):z.animationSlide&&(K?tt(z.animationSpeed/1e3,"0px"):V.animate({left:O+"px"},z.animationSpeed/2)),z.swipeClose&&50<Math.abs(N)&&Math.abs(L)<z.swipeTolerance&&st()}})},y=function(){var t=J+1<0?j.length-1:J+1>=j.length-1?0:J+1,e=J-1<0?j.length-1:J-1>=j.length-1?0:J-1;ot("<img />").attr("src",j.eq(t).attr(z.sourceAttr)).on("load",function(){-1==d.indexOf(ot(this).attr("src"))&&d.push(ot(this).attr("src")),j.eq(J).trigger(ot.Event("nextImageLoaded.simplelightbox"))}),ot("<img />").attr("src",j.eq(e).attr(z.sourceAttr)).on("load",function(){-1==d.indexOf(ot(this).attr("src"))&&d.push(ot(this).attr("src")),j.eq(J).trigger(ot.Event("prevImageLoaded.simplelightbox"))})},it=function(e){j.eq(J).trigger(ot.Event("change.simplelightbox")).trigger(ot.Event((1===e?"next":"prev")+".simplelightbox"));var t=J+e;if(!(m||(t<0||t>=j.length)&&!1===z.loop)){J=t<0?j.length-1:t>j.length-1?0:t,ot(".sl-wrapper .sl-counter .sl-current").text(J+1);var a={opacity:0};z.animationSlide&&(K?tt(z.animationSpeed/1e3,-100*e-L+"px"):a.left=parseInt(ot(".sl-image").css("left"))+-100*e+"px"),ot(".sl-image").animate(a,z.animationSpeed,function(){setTimeout(function(){var t=j.eq(J);Z.attr("src",t.attr(z.sourceAttr)),-1==d.indexOf(t.attr(z.sourceAttr))&&f.show(),ot(".sl-caption").remove(),_(e),z.preloading&&y()},100)})}},st=function(){if(!m){var t=j.eq(J),e=!1;t.trigger(ot.Event("close.simplelightbox")),z.history&&(a?history.pushState("",rt.title,n.pathname+n.search):n.hash="",clearTimeout(h)),ot(".sl-image img, .sl-overlay, .sl-close, .sl-navigation, .sl-image .sl-caption, .sl-counter").fadeOut("fast",function(){z.disableScroll&&C("show"),z.htmlClass&&""!=z.htmlClass&&ot("html").removeClass(z.htmlClass),ot(".sl-wrapper, .sl-overlay").remove(),G.off("click","button"),ot(rt).off("click."+U,".sl-close"),ot(lt).off("resize."+U),ot(lt).off("hashchange."+U),e||t.trigger(ot.Event("closed.simplelightbox")),e=!0}),Z=ot(),m=F=!1}},C=function(t){var e=0;if("hide"==t){var a=lt.innerWidth;if(!a){var n=rt.documentElement.getBoundingClientRect();a=n.right-Math.abs(n.left)}if(rt.body.clientWidth<a){var i=rt.createElement("div"),s=parseInt(ot("body").css("padding-right"),10);i.className="sl-scrollbar-measure",ot("body").append(i),e=i.offsetWidth-i.clientWidth,ot(rt.body)[0].removeChild(i),ot("body").data("padding",s),0<e&&ot("body").addClass("hidden-scroll").css({"padding-right":s+e})}}else ot("body").removeClass("hidden-scroll").css({"padding-right":ot("body").data("padding")});return e};return z.close&&s.appendTo(r),z.showCounter&&1<j.length&&(o.appendTo(r),o.find(".sl-total").text(j.length)),z.nav&&G.appendTo(r),z.spinner&&f.appendTo(r),j.on("click."+U,function(t){if(function(t){if(!z.fileExt)return!0;var e=ot(t).attr(z.sourceAttr).match(/\.([0-9a-z]+)(?=[?#])|(\.)(?:[\w]+)$/gim);return e&&"a"==ot(t).prop("tagName").toLowerCase()&&new RegExp(".("+z.fileExt+")$","i").test(e)}(this)){if(t.preventDefault(),m)return!1;var e=ot(this);v=j.index(e),c(e)}}),ot(rt).on("click."+U+" touchstart."+U,function(t){F&&z.docClose&&0===ot(t.target).closest(".sl-image").length&&0===ot(t.target).closest(".sl-navigation").length&&st()}),z.disableRightClick&&ot(rt).on("contextmenu",".sl-image img",function(t){return!1}),z.enableKeyboard&&ot(rt).on("keyup."+U,Q(function(t){L=0;var e=t.keyCode;m&&27==e&&(Z.attr("src",""),m=!1,st()),F&&(t.preventDefault(),27==e&&st(),37!=e&&39!=t.keyCode||it(39==t.keyCode?1:-1))},z.throttleInterval)),this.open=function(t){t=t||ot(this[0]),v=j.index(t),c(t)},this.next=function(){it(1)},this.prev=function(){it(-1)},this.close=function(){st()},this.destroy=function(){ot(rt).off("click."+U).off("keyup."+U),st(),ot(".sl-overlay, .sl-wrapper").remove(),this.off("click")},this.refresh=function(){this.destroy(),ot(this).simpleLightbox(z)},this}}(jQuery,window,document);
simplelightbox.scss 0000644 00000013073 15077052271 0010505 0 ustar 00 // You can customize Simplelightbox with the following variables:
$sl-font-family: Arial, Baskerville, monospace !default;
$sl-overlay-background: #fff !default;
$sl-overlay-opacity: 0.7 !default;
$sl-navigation-color: #000 !default;
$sl-caption-color: #fff !default;
$sl-caption-background: rgba(0, 0, 0, 0.8) !default;
$sl-counter-fontsize: 1rem !default;
$sl-caption-fontsize: 1rem !default;
$sl-close-fontsize: 3rem !default;
$sl-breakpoint-medium: 35.5em !default; // 568px, when 1em == 16px
$sl-breakpoint-large: 50em !default; // 800px, when 1em == 16px
$sl-arrow-fontsize-small: 2rem !default;
$sl-arrow-fontsize-medium: 3rem !default;
$sl-arrow-fontsize-large: 3rem !default;
$sl-img-border-small: 0 none !default;
$sl-img-border-medium: 0 none !default;
$sl-img-border-large: 0 none !default;
$sl-iframe-border-small: 0 none !default;
$sl-iframe-border-medium: 0 none !default;
$sl-iframe-border-large: 0 none !default;
$add-vendor-prefixes: true !default;
body.hidden-scroll {
overflow: hidden;
}
.sl-overlay {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: $sl-overlay-background;
opacity: $sl-overlay-opacity;
display: none;
z-index: 1035;
}
.sl-wrapper {
z-index: 1040;
button {
border: 0 none;
background: transparent;
font-size: 28px;
padding: 0;
cursor: pointer;
&:hover {
opacity: 0.7;
}
}
.sl-close {
display: none;
position: fixed;
right: 30px;
top: 30px;
z-index: 10060;
margin-top: -14px;
margin-right: -14px;
height: 44px;
width: 44px;
line-height: 44px;
font-family: $sl-font-family;
color: $sl-navigation-color;
font-size: $sl-close-fontsize;
&:focus {
outline: none;
}
}
.sl-counter {
display: none;
position: fixed;
top: 30px;
left: 30px;
z-index: 1060;
color: $sl-navigation-color;
font-size: $sl-counter-fontsize;
}
.sl-navigation {
width: 100%;
display: none;
button {
position: fixed;
top: 50%;
margin-top: -22px;
height: 44px;
width: 22px;
line-height: 44px;
text-align: center;
display: block;
z-index: 10060;
font-family: $sl-font-family;
color: $sl-navigation-color;
&.sl-next {
right: 5px;
font-size: $sl-arrow-fontsize-small;
}
&.sl-prev {
left: 5px;
font-size: $sl-arrow-fontsize-small;
}
&:focus {
outline: none;
}
@media (min-width: $sl-breakpoint-medium) {
width: 44px;
&.sl-next {
right: 10px;
font-size: $sl-arrow-fontsize-medium;
}
&.sl-prev {
left: 10px;
font-size: $sl-arrow-fontsize-medium;
}
}
@media (min-width: $sl-breakpoint-large) {
width: 44px;
&.sl-next {
right: 20px;
font-size: $sl-arrow-fontsize-large;
}
&.sl-prev {
left: 20px;
font-size: $sl-arrow-fontsize-large;
}
}
}
}
.sl-image {
position: fixed;
@if $add-vendor-prefixes {
-ms-touch-action: none;
}
touch-action: none;
z-index: 10000;
img {
margin: 0;
padding: 0;
display: block;
border: $sl-img-border-small;
width: 100%;
height: auto;
@media (min-width: $sl-breakpoint-medium) {
border: $sl-img-border-medium;
}
@media (min-width: $sl-breakpoint-large) {
border: $sl-img-border-large;
}
}
iframe {
background: #000;
border: $sl-iframe-border-small;
@media (min-width: $sl-breakpoint-medium) {
border: $sl-iframe-border-medium;
}
@media (min-width: $sl-breakpoint-large) {
border: $sl-iframe-border-large;
}
}
.sl-caption {
display: none;
padding: 10px;
color: $sl-caption-color;
background: $sl-caption-background;
font-size: $sl-caption-fontsize;
position: absolute;
bottom: 0;
left: 0;
right: 0;
&.pos-top {
bottom: auto;
top: 0;
}
&.pos-outside {
bottom: auto;
}
}
.sl-download {
display: none;
position: absolute;
bottom: 5px;
right: 5px;
color: $sl-navigation-color;
z-index: 1060;
}
}
}
.sl-spinner {
display: none;
border: 5px solid #333;
border-radius: 40px;
height: 40px;
left: 50%;
margin: -20px 0 0 -20px;
opacity: 0;
position: fixed;
top: 50%;
width: 40px;
z-index: 1007;
@if $add-vendor-prefixes {
-webkit-animation: pulsate 1s ease-out infinite;
-moz-animation: pulsate 1s ease-out infinite;
-ms-animation: pulsate 1s ease-out infinite;
-o-animation: pulsate 1s ease-out infinite;
}
animation: pulsate 1s ease-out infinite;
}
.sl-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll;
}
.sl-transition {
@if $add-vendor-prefixes {
transition: -moz-transform ease 200ms;
transition: -ms-transform ease 200ms;
transition: -o-transform ease 200ms;
transition: -webkit-transform ease 200ms;
}
transition: transform ease 200ms;
}
@-webkit-keyframes pulsate{
0% {
transform: scale(.1);
opacity: 0.0;
}
50% {
opacity: 1;
}
100% {
transform: scale(1.2);
opacity: 0;
}
}
@keyframes pulsate {
0% {
transform: scale(.1);
opacity: 0.0;
}
50% {
opacity: 1;
}
100% {
transform: scale(1.2);
opacity: 0;
}
}
@if $add-vendor-prefixes {
@-moz-keyframes pulsate{
0% {
transform: scale(.1);
opacity: 0.0;
}
50% {
opacity: 1;
}
100% {
transform: scale(1.2);
opacity: 0;
}
}
@-o-keyframes pulsate{
0% {
transform: scale(.1);
opacity: 0.0;
}
50% {
opacity: 1;
}
100% {
transform: scale(1.2);
opacity: 0;
}
}
@-ms-keyframes pulsate{
0% {
transform: scale(.1);
opacity: 0.0;
}
50% {
opacity: 1;
}
100% {
transform: scale(1.2);
opacity: 0;
}
}
}
|