mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 03:26:16 +00:00
Move JS to layout HTML for faster loading
Keep images square through JS and not a bug with ::after
This commit is contained in:
parent
ac2e73042e
commit
e9e3706172
7 changed files with 103 additions and 99 deletions
11
onlylegs/static/js/square.js
Normal file
11
onlylegs/static/js/square.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
function keepSquare() {
|
||||
const images = document.querySelectorAll('.gallery-item');
|
||||
for (let i = 0; i < images.length; i++) {
|
||||
images[i].style.height = images[i].offsetWidth + 'px';
|
||||
}
|
||||
|
||||
const groups = document.querySelectorAll('.group-item');
|
||||
for (let i = 0; i < groups.length; i++) {
|
||||
groups[i].style.height = groups[i].offsetWidth + 'px';
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue