MediaWiki:Mobile.js: Difference between revisions
Razor Blade (talk | contribs) No edit summary |
(No difference)
|
Latest revision as of 11:24, 8 August 2024
/* Mobile specific JavaScript */ function toggleGallery(link){var gallery=link.closest('.expandable-gallery');var fullGallery=gallery.querySelector('.gallery-full');if(fullGallery.style.display==='none'||fullGallery.style.display===''){fullGallery.style.display='block';link.textContent='[Collapse Gallery]';lazyLoadImages(fullGallery);}else{fullGallery.style.display='none';link.textContent='[Expand Gallery]';}} function lazyLoadImages(container){var images=container.querySelectorAll('img[data-src]');images.forEach(function(img){img.src=img.getAttribute('data-src');img.removeAttribute('data-src');});} document.addEventListener("DOMContentLoaded",function(){var galleries=document.querySelectorAll('.expandable-gallery .gallery-full img');galleries.forEach(function(img){img.setAttribute('data-src',img.src);img.removeAttribute('src');});});