Mudanças entre as edições de "MediaWiki: Common.js"

De WikiAjuda
Ir para: navegação, pesquisa
Linha 10: Linha 10:
 
         if (newWindowWidth < 481) {
 
         if (newWindowWidth < 481) {
 
           $('.newsection img').each(function() {
 
           $('.newsection img').each(function() {
                 $(this).removeClass().addClass('img-responsive center-block');
+
                 $(this).removeClass().addClass('img-responsive center-block').fadeIn();
 
           });
 
           });
 
         } else {
 
         } else {
Linha 18: Linha 18:
 
               var ratio = height / width;
 
               var ratio = height / width;
 
               if(ratio > 1.5) {
 
               if(ratio > 1.5) {
                   $(this).removeClass().addClass('img-mobile center-block');
+
                   $(this).removeClass().addClass('img-mobile center-block').fadeIn();
 
               }
 
               }
 
           });
 
           });

Edição das 17h55min 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) {
           $('.newsection img').each(function() {
                 $(this).removeClass().addClass('img-responsive center-block').fadeIn();
           });
        } 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').fadeIn();
              }
           });
        }
    }
});