User:P4wn4g3/common.js

From FreeSpace Wiki
< User:P4wn4g3
Revision as of 07:57, 1 October 2025 by P4wn4g3 (talk | contribs) (Created page with "JAVASCRIPT FIX: Forces image scaling in the Medal Box: $(document).ready(function() { // Select the table by its style attribute to target the Medal Box specifically...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* JAVASCRIPT FIX: Forces image scaling in the Medal Box */
$(document).ready(function() {
    // Select the table by its style attribute to target the Medal Box specifically
    var $medalTable = $('table[style*="border-collapse"]'); 
    
    // Target all images within that table
    $medalTable.find('img').each(function() {
        var $img = $(this);
        var originalWidth = 480; // The desired maximum width of the image

        // Manually override the width property to enforce responsiveness
        $img.css({
            'max-width': originalWidth + 'px',
            'width': '100%' 
        });
    });
});