码迷,mamicode.com
首页 > Web开发 > 详细

Jquery 最大高度

时间:2018-01-03 22:30:31      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:最大   htm   maxheight   char   ret   utf-8   http   ble   width   

    <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 最大高度

标签:最大   htm   maxheight   char   ret   utf-8   http   ble   width   

原文地址:https://www.cnblogs.com/ar13/p/8185623.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!