Anonymous

MediaWiki:Common.js: Difference between revisions

From The Blockheads Wiki
m
Reverted edits by FloofyPlasma (talk) to last revision by [[User:>Abcboy|>Abcboy]]
No edit summary
Tag: Reverted
m (Reverted edits by FloofyPlasma (talk) to last revision by [[User:>Abcboy|>Abcboy]])
Tag: Rollback
 
Line 18: Line 18:
     }
     }
     return;
     return;
   }
   };
   
   
   // get the page title
   // get the page title
Line 32: Line 32:
   }
   }
   
   
});
function mobileCheck() {
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
  return true
}else{
  return false
}
}
$(document).ready(function() {
    function setResponsiveWidths() {
    var element = document.getElementById("infobox-template");
        if (mobileCheck()) { // 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();
    });
});
});