mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
Formatted metadata
Add API for metadata Load more images if page is resized Adjusted animations
This commit is contained in:
parent
651fd8aa49
commit
da1579555b
9 changed files with 742 additions and 86 deletions
|
@ -24,33 +24,29 @@
|
|||
|
||||
{% block script %}
|
||||
<script>
|
||||
var images = document.querySelectorAll('.gallery__item-image');
|
||||
|
||||
function loadOnView() {
|
||||
var images = document.querySelectorAll('.gallery__item-image');
|
||||
for (var i = 0; i < images.length; i++) {
|
||||
var image = images[i];
|
||||
if (image.getBoundingClientRect().top < window.innerHeight && image.getBoundingClientRect().bottom > 0) {
|
||||
if (!image.src) {
|
||||
image.src = `/api/uploads/${image.getAttribute('data-src')}/400`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
window.onload = function() {
|
||||
for (var i = 0; i < images.length; i++) {
|
||||
var image = images[i];
|
||||
if (image.getBoundingClientRect().top < window.innerHeight && image.getBoundingClientRect().bottom > 0) {
|
||||
if (!image.src) {
|
||||
image.src = `/api/uploads/${image.getAttribute('data-src')}/400`
|
||||
}
|
||||
}
|
||||
}
|
||||
loadOnView();
|
||||
};
|
||||
|
||||
window.onscroll = function() {
|
||||
for (var i = 0; i < images.length; i++) {
|
||||
var image = images[i];
|
||||
if (image.getBoundingClientRect().top < window.innerHeight && image.getBoundingClientRect().bottom > 0) {
|
||||
if (!image.src) {
|
||||
image.src = `/api/uploads/${image.getAttribute('data-src')}/400`
|
||||
}
|
||||
}
|
||||
}
|
||||
loadOnView();
|
||||
};
|
||||
window.onresize = function() {
|
||||
loadOnView();
|
||||
};
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const src = urlParams.get('src');
|
||||
|
||||
if (src) {
|
||||
var imgOffset = document.getElementById('image-' + src).offsetTop;
|
||||
var imgHeight = document.getElementById('image-' + src).offsetHeight;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue