مدیاویکی:Common.js: تفاوت میان نسخهها
از ویکییاد
صفحهای تازه حاوی «←Any JavaScript here will be loaded for all users on every page load.: // Make gallery boxes use their img src as background-cover document.addEventListener('DOMContentLoaded', function() { document.querySelectorAll('.gallerybox').forEach(function(box) { const img = box.querySelector('img'); if (img && img.src) { box.style.backgroundImage = 'url(' + img.src + ')'; box.style.backgroundSize = 'cover'; box...» ایجاد کرد |
جز «مدیاویکی:Common.js» را محافظت کرد ([ویرایش=تنها مدیران] (بیپایان) [انتقال=تنها مدیران] (بیپایان)) |
||
(بدون تفاوت)
| |||
نسخهٔ ۲۳ ژانویهٔ ۲۰۲۶، ساعت ۱۹:۲۶
/* Any JavaScript here will be loaded for all users on every page load. */
// Make gallery boxes use their img src as background-cover
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('.gallerybox').forEach(function(box) {
const img = box.querySelector('img');
if (img && img.src) {
box.style.backgroundImage = 'url(' + img.src + ')';
box.style.backgroundSize = 'cover';
box.style.backgroundPosition = 'center';
box.style.backgroundRepeat = 'no-repeat';
// Optional: hide original img
img.style.display = 'none';
}
});
});
