fix: 首页图片居中显示,取消长按下载
This commit is contained in:
+1
-11
@@ -24,6 +24,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 30px;
|
gap: 30px;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image-item {
|
.image-item {
|
||||||
@@ -89,17 +90,6 @@
|
|||||||
var imgEl = document.createElement('img');
|
var imgEl = document.createElement('img');
|
||||||
imgEl.src = '/uploads/' + img.filename;
|
imgEl.src = '/uploads/' + img.filename;
|
||||||
imgEl.loading = 'lazy';
|
imgEl.loading = 'lazy';
|
||||||
var pressTimer;
|
|
||||||
imgEl.addEventListener('touchstart', function() {
|
|
||||||
pressTimer = setTimeout(function() {
|
|
||||||
var a = document.createElement('a');
|
|
||||||
a.href = '/uploads/' + img.filename;
|
|
||||||
a.download = img.original_name || 'image.jpg';
|
|
||||||
a.click();
|
|
||||||
}, 1000);
|
|
||||||
});
|
|
||||||
imgEl.addEventListener('touchend', function() { clearTimeout(pressTimer); });
|
|
||||||
imgEl.addEventListener('touchmove', function() { clearTimeout(pressTimer); });
|
|
||||||
div.appendChild(imgEl);
|
div.appendChild(imgEl);
|
||||||
grid.appendChild(div);
|
grid.appendChild(div);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user