Skip to content

Commit e65d5c7

Browse files
committed
[FEATURE] Add an option to make the zoom indicator optional
Related: #62
1 parent abdab7e commit e65d5c7

File tree

6 files changed

+26
-13
lines changed

6 files changed

+26
-13
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ Available options include:
215215
// Selector for a group of elements combined as a gallery, overrides the `data-group` attribute.
216216
gallerySelector: null,
217217

218+
// Display zoom indicator
219+
zoomIndicator: true,
220+
218221
// Display captions if available
219222
captions: true,
220223

dist/js/parvus.esm.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ function Parvus(userOptions) {
119119
const DEFAULT_OPTIONS = {
120120
selector: '.lightbox',
121121
gallerySelector: null,
122+
zoomIndicator: true,
122123
captions: true,
123124
captionsSelector: 'self',
124125
captionsAttribute: 'data-caption',
@@ -203,7 +204,9 @@ function Parvus(userOptions) {
203204
throw new Error('Ups, element already added.');
204205
}
205206
GROUPS[newGroup].triggerElements.push(el);
206-
addZoomIndicator(el, config);
207+
if (config.zoomIndicator) {
208+
addZoomIndicator(el, config);
209+
}
207210
el.classList.add('parvus-trigger');
208211
el.addEventListener('click', triggerParvus);
209212
if (isOpen() && newGroup === activeGroup) {
@@ -236,9 +239,9 @@ function Parvus(userOptions) {
236239
const EL_INDEX = GROUPS[EL_GROUP].triggerElements.indexOf(el);
237240
GROUPS[EL_GROUP].triggerElements.splice(EL_INDEX, 1);
238241
GROUPS[EL_GROUP].sliderElements.splice(EL_INDEX, 1);
239-
240-
// Remove lightbox indicator icon
241-
removeZoomIndicator(el);
242+
if (config.zoomIndicator) {
243+
removeZoomIndicator(el);
244+
}
242245
if (isOpen() && EL_GROUP === activeGroup) {
243246
updateAttributes();
244247
updateSliderNavigationStatus();

dist/js/parvus.esm.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/parvus.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
const DEFAULT_OPTIONS = {
126126
selector: '.lightbox',
127127
gallerySelector: null,
128+
zoomIndicator: true,
128129
captions: true,
129130
captionsSelector: 'self',
130131
captionsAttribute: 'data-caption',
@@ -209,7 +210,9 @@
209210
throw new Error('Ups, element already added.');
210211
}
211212
GROUPS[newGroup].triggerElements.push(el);
212-
addZoomIndicator(el, config);
213+
if (config.zoomIndicator) {
214+
addZoomIndicator(el, config);
215+
}
213216
el.classList.add('parvus-trigger');
214217
el.addEventListener('click', triggerParvus);
215218
if (isOpen() && newGroup === activeGroup) {
@@ -242,9 +245,9 @@
242245
const EL_INDEX = GROUPS[EL_GROUP].triggerElements.indexOf(el);
243246
GROUPS[EL_GROUP].triggerElements.splice(EL_INDEX, 1);
244247
GROUPS[EL_GROUP].sliderElements.splice(EL_INDEX, 1);
245-
246-
// Remove lightbox indicator icon
247-
removeZoomIndicator(el);
248+
if (config.zoomIndicator) {
249+
removeZoomIndicator(el);
250+
}
248251
if (isOpen() && EL_GROUP === activeGroup) {
249252
updateAttributes();
250253
updateSliderNavigationStatus();

dist/js/parvus.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/parvus.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export default function Parvus (userOptions) {
5555
const DEFAULT_OPTIONS = {
5656
selector: '.lightbox',
5757
gallerySelector: null,
58+
zoomIndicator: true,
5859
captions: true,
5960
captionsSelector: 'self',
6061
captionsAttribute: 'data-caption',
@@ -151,7 +152,9 @@ export default function Parvus (userOptions) {
151152

152153
GROUPS[newGroup].triggerElements.push(el)
153154

154-
addZoomIndicator(el, config)
155+
if (config.zoomIndicator) {
156+
addZoomIndicator(el, config)
157+
}
155158

156159
el.classList.add('parvus-trigger')
157160
el.addEventListener('click', triggerParvus)
@@ -191,8 +194,9 @@ export default function Parvus (userOptions) {
191194
GROUPS[EL_GROUP].triggerElements.splice(EL_INDEX, 1)
192195
GROUPS[EL_GROUP].sliderElements.splice(EL_INDEX, 1)
193196

194-
// Remove lightbox indicator icon
195-
removeZoomIndicator(el)
197+
if (config.zoomIndicator) {
198+
removeZoomIndicator(el)
199+
}
196200

197201
if (isOpen() && EL_GROUP === activeGroup) {
198202
updateAttributes()

0 commit comments

Comments
 (0)