Step1:
Welcome to designer blog, here we are going to discuss about, Howto make columns height equal using Jquery
Step2:
Html Markup
<div id ="left"> </div >
<div id ="right"> </div >
Depend upon thecontent both right and left div's height may be vary . so that we can fix this
by using jquery .
Step3:
Math. max will calculate the two divs height and takes the highest height either it may be left or right.
$( document). ready( function( ) {
var d = Math.max($("#left").height(), $("#right").height());
$( "#left"). height( d);
$( "#right"). height( d);
});
Highest height will be assigned to both left and right, so that both column render in same height.
Step4:
Setting the equal heights in Responsive view. Below is the function, Where we can set the height: auto for mobile view and other resolution like tablet and desktop will set the equal heights based on left and right "Div Element" which is greater than one another.
Function MaxHeights ()
{
if ( $( window). width( ) <= 767)
{
$( "#left") .css( 'height', 'auto');
$( "#right") .css( 'height', 'auto');
}
else
{
$( "#left"). height( "");
$( "#right"). height( "");
var MaxHeight = Math.max($("#left").height(), $("#right").height());
$( "#left"). height( MaxHeight );
$( "#right"). height( MaxHeight );
}
}
$( window). resize( function( ) {
MaxHeights ( );
});
$( window). load( function( ) {
MaxHeights ( );
});
Step4:
Enjoy folks
Welcome to designer blog, here we are going to discuss about, How
Step2:
Html Markup
<
<
Depend upon the
Step3:
Math
$
var d = Math.max($("#left").height(), $("#right").height());
$
$
});
Highest height will be assigned to both left and right, so that both column render in same height.
Step4:
Setting the equal heights in Responsive view. Below is the function
Function MaxHeights ()
{
{
$
$
}
{
$
$
var MaxHeight = Math.max($("#left").height(), $("#right").height());
$
$
}
}
$
});
$
});
Step4:
Enjoy folks
No comments:
Post a Comment