Mudanças entre as edições de "MediaWiki: Common.js"
De WikiAjuda
Linha 13: | Linha 13: | ||
}); | }); | ||
} else { | } else { | ||
− | $(' | + | $('.newsection img').each(function() { |
var width = $(this).width(); // Current image width | var width = $(this).width(); // Current image width | ||
var height = $(this).height(); // Current image height | var height = $(this).height(); // Current image height |
Edição das 17h45min de 26 de maio de 2019
$(document).ready(function () {
$(window).on("resize", function (e) {
checkScreenSize();
});
checkScreenSize();
function checkScreenSize(){
var newWindowWidth = $(window).innerWidth();
if (newWindowWidth < 481) {
$('mw-mmv-view-expanded img').each(function() {
$(this).removeClass().addClass('img-responsive center-block');
});
} else {
$('.newsection img').each(function() {
var width = $(this).width(); // Current image width
var height = $(this).height(); // Current image height
var ratio = height / width;
if(ratio > 1.5) {
$(this).removeClass().addClass('img-mobile center-block');
}
});
}
}
});