Mudanças entre as edições de "MediaWiki: Common.js"
De WikiAjuda
(Limpou toda a página) (Etiqueta: anulando) |
|||
Linha 1: | Linha 1: | ||
+ | $(document).ready(function () { | ||
+ | $(window).on("resize", function (e) { | ||
+ | checkScreenSize(); | ||
+ | }); | ||
+ | checkScreenSize(); | ||
+ | |||
+ | function checkScreenSize(){ | ||
+ | var newWindowWidth = $(window).width(); | ||
+ | if (newWindowWidth < 481) { | ||
+ | $('mw-mmv-view-expanded img').each(function() { | ||
+ | $(this).removeClass().addClass('img-responsive center-block'); | ||
+ | }); | ||
+ | } else { | ||
+ | $('mw-mmv-view-expanded 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'); | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | } | ||
+ | }); |
Edição das 16h39min de 26 de maio de 2019
$(document).ready(function () {
$(window).on("resize", function (e) {
checkScreenSize();
});
checkScreenSize();
function checkScreenSize(){
var newWindowWidth = $(window).width();
if (newWindowWidth < 481) {
$('mw-mmv-view-expanded img').each(function() {
$(this).removeClass().addClass('img-responsive center-block');
});
} else {
$('mw-mmv-view-expanded 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');
}
});
}
}
});