Responsive Equal Height Columns using jQuery

Developer
Size
3,830 Kb
Views
32,384

How do I make an responsive equal height columns using jquery?

Equal height columns that adjust on resize events and have a specific small-screen behavior.Find the tallest column and apply that value to the rest, on load and resize. Remove height when screen is smaller than x.. What is a responsive equal height columns using jquery? How do you make a responsive equal height columns using jquery? This script and codes were developed by Laura Moraiti on 27 August 2022, Saturday.

Responsive Equal Height Columns using jQuery Previews

Responsive Equal Height Columns using jQuery - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Responsive Equal Height Columns using jQuery</title> <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Playfair+Display:900' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="cols"> <div class="col"> <div class="content"> <div class="title"> <h3>Baby title</h3> </div> <div class="details"> <h5>Hello</h5> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <h5>Hello</h5> <p>Velit iste nemo, nesciunt id officia exercitationem dolorum recusandae at doloribus tempore. Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> </div> </div> <div class="action"><sup>$</sup><strong>500</strong></div> </div> <div class="col"> <div class="content"> <div class="title"> <h3>Short title</h3> </div> <div class="details"> <h5>Hello</h5> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <h5>Hello</h5> <p>Velit iste nemo, nesciunt id officia exercitationem dolorum recusandae at doloribus tempore.</p> <h5>Hello</h5> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> </div> </div> <div class="action"><sup>$</sup><strong>850</strong></div> </div> <div class="col"> <div class="content"> <div class="title"> <h3>Longer, yet short title</h3> </div> <div class="details"> <h5>Hello</h5> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <h5>Hello</h5> <p>Velit iste nemo, nesciunt id officia exercitationem dolorum recusandae at doloribus tempore.</p> <h5>Hello</h5> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <h5>Hello</h5> <p>Velit iste nemo, nesciunt id officia exercitationem dolorum recusandae at doloribus tempore.</p> </div> </div> <div class="action"><sup>$</sup><strong>1000</strong></div> </div> <div class="col"> <div class="content"> <div class="title"> <h3>Longest of them all, like a bad movie</h3> </div> <div class="details"> <h5>Hello</h5> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <h5>Hello</h5> <p>Velit iste nemo, nesciunt id officia exercitationem dolorum recusandae at doloribus tempore.</p> <h5>Hello</h5> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <h5>Hello</h5> <p>Velit iste nemo, nesciunt id officia exercitationem dolorum recusandae at doloribus tempore.</p> <h5>Hello</h5> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <h5>Hello</h5> <p>Velit iste nemo, nesciunt id officia exercitationem dolorum recusandae at doloribus tempore.</p> </div> </div> <div class="action"><sup>$</sup><strong>1.000.000</strong></div> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Responsive Equal Height Columns using jQuery - Script Codes CSS Codes

* { box-sizing: border-box;
}
h3 { font-family: "Playfair Display", serif; font-size: 1.5em; margin-bottom: 1rem; color: #AF9751;
}
h5 { font-family: "Source Sans Pro", sans-serif; font-size: 1em; text-transform: uppercase; margin-bottom: .5rem;
}
.col { float: left; width: 25%;
}
@media (max-width: 800px) { .col { width: 100%; float: none; }
}
.content { padding: 1em; background-color: #fff;
}
.content * { margin-top: 0; text-align: center;
}
.content p { font-family: "Source Sans Pro", sans-serif; font-size: .9em; display: inline-block;
}
.content p:last-of-type { margin-bottom: 0;
}
.action { font-family: "Playfair Display", serif; text-align: center; background-color: black; color: #fff; letter-spacing: 1px; padding: 1em; font-size: 1.15em; cursor: pointer; transition: all .3s ease-in-out;
}
.action sup { color: rgba(255, 255, 255, 0.75);
}
.action strong { font-size: 1.5em;
}
.action:hover { background-color: #AF9751;
}
@media (max-width: 800px) { .hide-empty { display: none; }
}

Responsive Equal Height Columns using jQuery - Script Codes JS Codes

(function(){ var equalH = { config: { elem: ['.content', '.title'],	w: 800 }, max: function(map) { var maxVal = Math.max.apply(null, map); return maxVal; }, map: function(ele, inner) { var eleH = $(ele) .map(function() { // On Load: height of the container if(inner !== true) { return $(this).height(); } // On resize: measure and sum up height of children to update height else { var totalHeight = 0; $(this).children().each(function() {	totalHeight += $(this).outerHeight(true); }); return totalHeight; } }) .get(); // Returns [a, b, c] clean, with no extra data return eleH; }, apply: function(ele, inner) { var f = equalH, max = f.max, map = f.map, w = f.config.w; if( $(window).width() > w ) { ele.height(max(map(ele, inner))); } else { ele .removeAttr('style') // Hide empty children on responsive view .children(':empty') .parent().addClass('hide-empty'); } }, onResize: function(ele) { var f = equalH; // On load f.apply(ele); // On resize $(window).resize(function(){ f.apply(ele, true); }); }, init: function(config){ $.extend(this.config, config); var f = equalH, elem = f.config.elem; // Loop through multiple elements $.each(elem, function(index, value){ var ele = $(value); f.onResize(ele); }); } }; equalH.init();
})();
Responsive Equal Height Columns using jQuery - Script Codes
Responsive Equal Height Columns using jQuery - Script Codes
Home Page Home
Developer Laura Moraiti
Username Fixie
Uploaded August 27, 2022
Rating 3
Size 3,830 Kb
Views 32,384
Do you need developer help for Responsive Equal Height Columns using jQuery?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Laura Moraiti (Fixie) Script Codes
Create amazing art & images with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!