Jquery make element as taller as tallest element on resize -


i have jsfiddle here - https://jsfiddle.net/mx3sqksn/1/

i have 2 element (p tags here)

they have different heights don't know heights be.

i need both elememts tall tallest of two.

i need responsive when window smaller , element taller both staye same height.

i know there other ways of doing display: table; can't in actual code.

        var fluid_box = function() {           var highest = 0;           var hi = 0;           $(".text").each(function(){             var h = $(this).height();             if(h > hi){                hi = h;                highest = $(this).height();              }              $(".text").css('height', highest);            });          }           // fire on dom ready         fluid_box();          // fire upon resize         $atj(window).resize(fluid_box); 

as want work on resize, need clear inline height styles added, check tallest.

you can clear style setting empty string. e.g. $(".text").css('height', '') remove inline height="" completely. height of content, until set inline again.

jsfiddle: https://jsfiddle.net/mx3sqksn/6/

var fluid_box = function () {     var highest = 0;     var hi = 0;     $(".text").css('height', '').each(function () {         var h = $(this).height();         if (h > hi) {             hi = h;             highest = $(this).height();         }      });     $('#output').html(highest);     $(".text").css('height', highest); }  // fire on dom ready fluid_box();  // fire upon resize $(window).resize(fluid_box); 

note: jsfiddle not firing resize event, changed $(window).resize(fluid_box);.


Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -