مدیاویکی:Common.js: تفاوت میان نسخه‌ها

    بدون خلاصۀ ویرایش
    بدون خلاصۀ ویرایش
    برچسب: برگردانده‌شده
    خط ۶۹۸: خط ۶۹۸:


    })( jQuery );
    })( jQuery );
    function align_mp_box() {
      var firstColumn = $('.portal-column-right-extra-wide');
      var secondColumn = $('.portal-column-left-extra-narrow');
      var firstColumnLastChild = firstColumn.children().last();
      var secondColumnLastChild = secondColumn.children().last();
      var firstChildDataPaddingBottom = firstColumnLastChild.data('padding-bottom');
      var secondChildDataPaddingBottom = secondColumnLastChild.data('padding-bottom');
      if (typeof firstChildDataPaddingBottom == 'undefined') {
        firstChildDataPaddingBottom = Math.round(parseInt(firstColumnLastChild.css('padding-bottom')));
        firstColumnLastChild.data('padding-bottom', firstChildDataPaddingBottom);
      }
      if (typeof secondChildDataPaddingBottom == 'undefined') {
        secondChildDataPaddingBottom = Math.round(parseInt(secondColumnLastChild.css('padding-bottom')));
        secondColumnLastChild.data('padding-bottom', secondChildDataPaddingBottom);
      }
      firstColumnLastChild.css('padding-bottom', firstChildDataPaddingBottom)
      secondColumnLastChild.css('padding-bottom', secondChildDataPaddingBottom)
      var firstColumnHeight = firstColumn.height();
      var secondColumnHeight = secondColumn.height();
      var diff = Math.round(firstColumnHeight - secondColumnHeight);
      var lastChild = null;
      var lastChildPaddingBottom = null;
      if (diff > 0) {
        lastChild = secondColumn.children().last();
        lastChildPaddingBottom = secondChildDataPaddingBottom;
      } else {
        lastChild = firstColumn.children().last();
        lastChildPaddingBottom = firstChildDataPaddingBottom;
        diff = Math.abs(diff);
      }
      lastChild.css('padding-bottom', (lastChildPaddingBottom + diff));
    }
    jQuery(window).on('load', function () {
      align_mp_box();
    });
    jQuery(window).on('resize', function () {
      align_mp_box();
    });