Home >Web Front-end >JS Tutorial >jQuery method to find the highest element on a web page_jquery

jQuery method to find the highest element on a web page_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:08:171665browse

The example in this article describes how jQuery finds the highest element on a web page. Share it with everyone for your reference. The details are as follows:

This JS code uses jQuery to traverse the elements on the web page and find the highest element among them

$(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 will be helpful to everyone’s jQuery programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn