forked from neff/neff-steindesign.de
Fix lightbox script, Update example content
This commit is contained in:
parent
99545a988b
commit
57afeb1b10
|
|
@ -4,6 +4,20 @@ date = "2019-01-08T19:30:48+01:00"
|
||||||
draft = true
|
draft = true
|
||||||
type = "page"
|
type = "page"
|
||||||
keywords = []
|
keywords = []
|
||||||
|
|
||||||
|
[[resources]]
|
||||||
|
src = "bilder/bild-1.jpg"
|
||||||
|
title = "Bild 1"
|
||||||
|
[resources.params]
|
||||||
|
alt = "Alt Bild 1"
|
||||||
|
description = "Description Bild 1"
|
||||||
|
|
||||||
|
[[resources]]
|
||||||
|
src = "bilder/bild-2.jpg"
|
||||||
|
title = "Bild 2"
|
||||||
|
[resources.params]
|
||||||
|
alt = "Alt Bild 2"
|
||||||
|
description = "Description Bild 2"
|
||||||
+++
|
+++
|
||||||
|
|
||||||
# Text
|
# Text
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -11,12 +11,17 @@ class Lightbox {
|
||||||
this.element = images[idx];
|
this.element = images[idx];
|
||||||
this.figure = this.element.parentElement;
|
this.figure = this.element.parentElement;
|
||||||
this.image = this.element.firstChild;
|
this.image = this.element.firstChild;
|
||||||
this.title = this.figure.querySelector('h3').innerHTML
|
this.title = this.figure.querySelector('h3')
|
||||||
this.description = this.figure.querySelector('.description p').innerHTML
|
this.title = this.image.getAttribute('title')
|
||||||
|
this.description = this.figure.querySelector('.description p')
|
||||||
|
if (this.description !== null) {
|
||||||
|
this.description = this.description.innerHTML
|
||||||
|
}
|
||||||
|
|
||||||
this.href = this.element.getAttribute('href')
|
this.href = this.element.getAttribute('href')
|
||||||
this.alt = this.image.getAttribute('alt')
|
this.alt = this.image.getAttribute('alt')
|
||||||
this.template = template.cloneNode(true);
|
this.template = template.cloneNode(true);
|
||||||
|
console.log(this.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
|
|
@ -47,7 +52,12 @@ class Lightbox {
|
||||||
img.setAttribute('alt', this.alt);
|
img.setAttribute('alt', this.alt);
|
||||||
let title = lightbox.querySelector('.lightbox-title');
|
let title = lightbox.querySelector('.lightbox-title');
|
||||||
let description = lightbox.querySelector('.lightbox-footer');
|
let description = lightbox.querySelector('.lightbox-footer');
|
||||||
|
if (this.title !== null) {
|
||||||
title.innerHTML = this.title;
|
title.innerHTML = this.title;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
title.innerHtml = this.alt;
|
||||||
|
}
|
||||||
if (this.description !== null) {
|
if (this.description !== null) {
|
||||||
description.innerHTML = this.description;
|
description.innerHTML = this.description;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue