MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
var $iframe = $('iframe'),
if (window.innerWidth > 601) {
     src = $iframe.data('src');
    //Run JS code that is to be loaded only on desktop browsers
     console.log("This will run only in desktop browsers");
}


if (window.matchMedia("(min-width: 480px)").matches) {
if (window.innerWidth < 601) {
    $iframe.attr('src', src);
    //Remove HTML elements not to be shown in mobile devices
    document.getElementById("extra-info").remove();
}
}