Prepend 0 to index if under 10 on Photo Viewer

This commit is contained in:
2021-11-22 23:18:47 +01:00
parent 4c43e1458e
commit ac8c49d954

View File

@@ -33,6 +33,7 @@
$: canGoNext = !isLoading && (hasPrev || currentIndex !== 0)
// Define current photo
$: currentPhoto = photos[currentIndex]
$: currentPhotoIndex = globalOffset + currentIndex + 1
// Take 7 photos in the global photos array (5 for current, 1 before first and 1 after last)
// Start one index before the current image since the first one will be invisible
@@ -191,7 +192,7 @@
</div>
<span class="viewer-photo__index title-index">
{globalOffset + currentIndex + 1}
{(currentPhotoIndex < 10) ? '0' : ''}{currentPhotoIndex}
</span>
</div>