Compare commits
2 commits
2c4d108715
...
e48a1415a6
Author | SHA1 | Date | |
---|---|---|---|
e48a1415a6 | |||
a6e76776cc |
3 changed files with 16 additions and 8 deletions
|
@ -217,7 +217,7 @@ function loadGallery(images, idx, main, thumbnails) {
|
|||
}
|
||||
})
|
||||
|
||||
function updateGallery(index) {
|
||||
function updateGallery(index, init) {
|
||||
mainImage.src = images[index].src.replace('_display', '_thumbnail');
|
||||
setTimeout(() => {
|
||||
mainImage.src = images[index].src;
|
||||
|
@ -253,10 +253,12 @@ function loadGallery(images, idx, main, thumbnails) {
|
|||
}
|
||||
prevBtn.disabled = index === 0;
|
||||
nextBtn.disabled = index === images.length - 1;
|
||||
if (idx == 'inline') {
|
||||
document.location.hash = `#${index + 1}`
|
||||
} else {
|
||||
document.location.hash = `#${idx + 1}/${index + 1}`
|
||||
if (!init) {
|
||||
if (idx == 'inline') {
|
||||
document.location.hash = `#${index + 1}`
|
||||
} else {
|
||||
document.location.hash = `#${idx + 1}/${index + 1}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,7 +301,7 @@ function loadGallery(images, idx, main, thumbnails) {
|
|||
};
|
||||
|
||||
idx != 'inline' && createThumbnails();
|
||||
updateGallery(currentIndex);
|
||||
updateGallery(currentIndex, true);
|
||||
|
||||
const imagesIndex = images.map(img => img.src);
|
||||
return {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<li><a href="{{ gallery.get_absolute_url }}#{{forloop.counter}}"><img src="{{ photo.get_thumbnail_url }}"
|
||||
class="photo"
|
||||
data-caption="{{ photo.caption_html }}"
|
||||
{% if request.user.is_staff %}data-orig="{{ photo.image.url }}"{% endif %}
|
||||
data-orig="{{ photo.image.url }}"
|
||||
{% if request.user.is_staff %}data-edit="{{ photo.edit_url }}"{% endif %}
|
||||
></a></li>
|
||||
{% endfor %}
|
||||
|
|
|
@ -33,7 +33,13 @@
|
|||
{% for photo in gallery.public %}
|
||||
<div style="float: left; padding: 4px">
|
||||
<a href="{{ gallery.get_absolute_url }}#{{forloop.counter}}">
|
||||
<img src="{{ photo.get_thumbnail_url }}" class="thumbnail photo" alt="{{ photo.title }}" data-caption="{{ photo.caption_html }}"{% if request.user.is_staff %} data-orig="{{ photo.image.url }}"{% endif %}>
|
||||
<img
|
||||
src="{{ photo.get_thumbnail_url }}"
|
||||
class="thumbnail photo"
|
||||
alt="{{ photo.title }}"
|
||||
data-caption="{{ photo.caption_html }}"
|
||||
data-orig="{{ photo.image.url }}"
|
||||
>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue