EduardET

Js - set the same height for text module in various columns

Dec 19th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. <script>
  2. ( function( $ ) {
  3.     $( document ).ready( function() {
  4.         function setHeight( el ) {
  5.             var maxHeight = 0,
  6.                 product = el.find( ".product-description" );
  7.             if ( product.length ) {
  8.                 product.each( function() {
  9.                     if ( $( this ).height() > maxHeight ) {
  10.                         maxHeight = $( this ).height();
  11.                     }
  12.                 } );
  13.  
  14.                 product.css( 'min-height', maxHeight );
  15.             }
  16.         }
  17.         if ( $( window ).width() > 980 ) {
  18.             $( ".wpc-cols" ).each( function() {
  19.                 setHeight( $( this ) );
  20.             } );
  21.         }
  22.  
  23.         $( window ).resize( function() {
  24.             if ( $( window ).width() > 980 ) {
  25.                 $( ".wpc-cols" ).each( function() {
  26.                     setHeight( $( this ) );
  27.                 } );
  28.             }
  29.         } )
  30.     } );
  31. } )( jQuery );
  32. </script>
Advertisement
Add Comment
Please, Sign In to add comment