MediaWiki:Common.js: Difference between revisions
From The Blockheads Wiki
attempt to improve mobile support
>Abcboy |
FloofyPlasma (talk | contribs) (attempt to improve mobile support) Tag: Reverted |
||
Line 32: | Line 32: | ||
} | } | ||
}); | |||
$(document).ready(function() { | |||
function setResponsiveWidths() { | |||
var element = $('infobox-template'); // Target the class you defined | |||
if (window.innerWidth <= 768) { // Mobile breakpoint | |||
element.css('max-width', '100%'); // Set max width for mobile | |||
} else { | |||
element.css('max-width', '30%'); // Set max width for desktop | |||
} | |||
} | |||
// Call on page load | |||
setResponsiveWidths(); | |||
// Call on window resize | |||
$(window).resize(function() { | |||
setResponsiveWidths(); | |||
}); | |||
}); | }); |