jQuery's method for finding the highest element on a web page

  • 2020-05-19 04:04:56
  • OfStack

This example shows how jQuery finds the highest element on a web page. Share with you for your reference. The details are as follows:

This JS code iterates through the elements on the page by jQuery to find the highest one


$(document).ready(function() {
  var maxHeight = -1;
  $('.features').each(function() {
   maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
  });
  $('.features').each(function() {
   $(this).height(maxHeight);
  });
});

I hope this article has been helpful to your jQuery programming.


Related articles: