ocastaneda82
10/25/2017 - 4:53 PM

Altura JS

Detecta altura y se lo pone a los demás elementos.

  // altura h2 productos
  function altura($valor) {
    if ($valor.length > 0) {
      var max = -1;
      $valor.each(function() {
        $(this).css('height', 'auto');
        var h = $(this).height();
        max = h > max ? h : max;
      });
      $valor.height(max);
    }
  }

  var ancho = $(window).width();

  if( ancho >= 768 ){
    altura($('.filtr-item'));
    $(window).resize(function() {
      altura($('.filtr-item'));
    });
  }
  $( document.body ).on( 'post-load', function () {
    altura($('.filtr-item'));
  } );