Advertisement
Guest User

Untitled

a guest
Jan 4th, 2025
630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.55 KB | Source Code | 0 0
  1. let targetWidth = 240;
  2. let scale = targetWidth / 200;
  3.  
  4. let gdt = document.getElementById('gdt');
  5. gdt.style.maxWidth = `${targetWidth*6+20}px`;
  6. gdt.style.gridTemplateColumns = `repeat(auto-fill,minmax(${targetWidth}px,1fr))`;
  7. gdt.style.gap = '1px';
  8. gdt.style.padding = '1px';
  9.  
  10. for(let link of gdt.getElementsByTagName('a')){
  11.   let img = link.firstChild;
  12.   link.style.width = `${img.offsetWidth * scale}px`;
  13.   link.style.height = `${img.offsetHeight * scale}px`;
  14.   img.style.transformOrigin = 'top left';
  15.   img.style.transform = `scale(${scale})`;
  16. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement