Skip to content

Commit

Permalink
Version 1.4.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinchoolur committed Oct 13, 2020
1 parent bdae4d4 commit 360e6e8
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 31 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lightgallery.js",
"version": "1.3.1",
"version": "1.4.0",
"description": "Full featured lightbox gallery. Zero dependencies",
"main": [
"dist/js/lightgallery.min.js",
Expand Down
6 changes: 3 additions & 3 deletions dist/css/lightgallery.css
Original file line number Diff line number Diff line change
Expand Up @@ -885,17 +885,17 @@ body:not(.lg-from-hash) .lg-outer.lg-start-zoom .lg-item.lg-complete .lg-object
content: "\e903";
}

.group {
.lg-group {
*zoom: 1;
}

.group:before, .group:after {
.lg-group:before, .lg-group:after {
display: table;
content: "";
line-height: 0;
}

.group:after {
.lg-group:after {
clear: both;
}

Expand Down
2 changes: 1 addition & 1 deletion dist/css/lightgallery.min.css

Large diffs are not rendered by default.

59 changes: 36 additions & 23 deletions dist/js/lightgallery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* lightgallery.js | 1.3.1 | September 19th 2020
* lightgallery.js | 1.4.0 | October 13th 2020
* http://sachinchoolur.github.io/lightgallery.js/
* Copyright (c) 2016 Sachin N;
* @license GPLv3
Expand Down Expand Up @@ -245,6 +245,8 @@
addClass: '',
startClass: 'lg-start-zoom',
backdropDuration: 150,

// Set 0, if u don't want to hide the controls
hideBarsDelay: 6000,

useLeft: false,
Expand Down Expand Up @@ -302,7 +304,8 @@

dynamic: false,
dynamicEl: [],
galleryId: 1
galleryId: 1,
supportLegacyBrowser: true
};

function Plugin(element, options) {
Expand Down Expand Up @@ -469,17 +472,28 @@
_lgUtils2.default.trigger(_this.el, 'onAfterOpen');

// Hide controllers if mouse doesn't move for some period
_lgUtils2.default.on(_this.outer, 'mousemove.lg click.lg touchstart.lg', function () {

_lgUtils2.default.removeClass(_this.outer, 'lg-hide-items');

clearTimeout(_this.hideBartimeout);
if (_this.s.hideBarsDelay > 0) {

// Timeout will be cleared on each slide movement also
_this.hideBartimeout = setTimeout(function () {
// Hide controls if user doesn't use mouse or touch after opening gallery
var initialHideBarTimeout = setTimeout(function () {
_lgUtils2.default.addClass(_this.outer, 'lg-hide-items');
}, _this.s.hideBarsDelay);
});
_lgUtils2.default.on(_this.outer, 'mousemove.lg click.lg touchstart.lg', function () {

// Cancel initalHideBarTimout if user uses mouse or touch events
// Before it fires
clearTimeout(initialHideBarTimeout);

_lgUtils2.default.removeClass(_this.outer, 'lg-hide-items');

clearTimeout(_this.hideBartimeout);

// Timeout will be cleared on each slide movement also
_this.hideBartimeout = setTimeout(function () {
_lgUtils2.default.addClass(_this.outer, 'lg-hide-items');
}, _this.s.hideBarsDelay);
});
}
};

Plugin.prototype.structure = function () {
Expand Down Expand Up @@ -510,7 +524,7 @@
var ariaLabelledby = this.s.ariaLabelledby ? 'aria-labelledby="' + this.s.ariaLabelledby + '"' : '';
var ariaDescribedby = this.s.ariaDescribedby ? 'aria-describedby="' + this.s.ariaDescribedby + '"' : '';

template = '<div tabindex="-1" aria-modal="true" ' + ariaLabelledby + ' ' + ariaDescribedby + ' role="dialog" class="lg-outer ' + this.s.addClass + ' ' + this.s.startClass + '">' + '<div class="lg" style="width:' + this.s.width + '; height:' + this.s.height + '">' + '<div class="lg-inner">' + list + '</div>' + '<div class="lg-toolbar group">' + '<button type="button" aria-label="Close gallery" class="lg-close lg-icon"></button>' + '</div>' + controls + subHtmlCont + '</div>' + '</div>';
template = '<div tabindex="-1" aria-modal="true" ' + ariaLabelledby + ' ' + ariaDescribedby + ' role="dialog" class="lg-outer ' + this.s.addClass + ' ' + this.s.startClass + '">' + '<div class="lg" style="width:' + this.s.width + '; height:' + this.s.height + '">' + '<div class="lg-inner">' + list + '</div>' + '<div class="lg-toolbar lg-group">' + '<button type="button" aria-label="Close gallery" class="lg-close lg-icon"></button>' + '</div>' + controls + subHtmlCont + '</div>' + '</div>';

document.body.insertAdjacentHTML('beforeend', template);
this.outer = document.querySelector('.lg-outer');
Expand Down Expand Up @@ -883,12 +897,15 @@

if (_srcset) {
_img.setAttribute('srcset', _srcset);
try {
picturefill({
elements: [_img[0]]
});
} catch (e) {
console.error('Make sure you have included Picturefill version 2');

if (this.s.supportLegacyBrowser) {
try {
picturefill({
elements: [_img[0]]
});
} catch (e) {
console.warn('If you want srcset to be supported for older browsers, ' + 'please include picturefil javascript library in your document.');
}
}
}

Expand Down Expand Up @@ -1591,14 +1608,10 @@
window.lgData[uid] = new Plugin(el, options);
el.setAttribute('lg-uid', uid);
} else {
try {
window.lgData[el.getAttribute('lg-uid')].init();
} catch (err) {
console.error('lightGallery has not initiated properly');
}
window.lgData[el.getAttribute('lg-uid')].init();
}
} catch (err) {
console.error('lightGallery has not initiated properly');
console.error('lightGallery has not initiated properly', err);
}
};
});
Expand Down
4 changes: 2 additions & 2 deletions dist/js/lightgallery.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lightgallery.js",
"version": "1.3.1",
"version": "1.4.0",
"description": "Full featured lightbox gallery. Zero dependencies",
"keywords": [
"gallery",
Expand Down

0 comments on commit 360e6e8

Please sign in to comment.