Jquery 最大高度
阿新 • • 發佈:2018-01-04
view mat 高度 style mark class init pos 20px
<html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <div style="height:100px;"></div> <div style="height:200px;"></div> <div style="height:220px;"></div> <div style="height:130px;"></div> <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script> <script> (function($){ $.fn.maxHeight = function(){ var max = 0; this.each(function(){ max = Math.max(max,$(this).height()) }) return max; } })(jQuery) console.log( $("div").maxHeight() ) </script> </body> </html>
Jquery 最大高度