Fix mobile view Bugs and add versions to static files for cache breaking
This commit is contained in:
+12
-2
@@ -5,6 +5,12 @@
|
||||
let index = 0;
|
||||
let swipe = null;
|
||||
|
||||
function mediaUrl(url) {
|
||||
if (!url) return '';
|
||||
const separator = url.includes('?') ? '&' : '?';
|
||||
return `${url}${separator}v=${Date.now()}`;
|
||||
}
|
||||
|
||||
function activate(selector, handler) {
|
||||
$(document)
|
||||
.on('pointerup', selector, function (event) {
|
||||
@@ -33,8 +39,12 @@
|
||||
|
||||
const image = images[index];
|
||||
$('#slide-image')
|
||||
.attr('src', image.url)
|
||||
.attr('alt', image.caption || 'Bild zur Station');
|
||||
.attr('src', mediaUrl(image.url))
|
||||
.attr('alt', image.caption || 'Bild zur Station')
|
||||
.off('error.wegwichtel')
|
||||
.on('error.wegwichtel', function () {
|
||||
$(this).removeAttr('src').attr('alt', 'Bild konnte nicht geladen werden');
|
||||
});
|
||||
$('#slide-caption').text(image.caption || '');
|
||||
$('#slide-position').text(`${index + 1} / ${images.length}`);
|
||||
refreshButton('#slide-prev', images.length < 2);
|
||||
|
||||
Reference in New Issue
Block a user