无法显示完整的浏览器高度

时间:2015-06-01 13:30:29

标签: css background-image

我的代码没有使用jQuery代码显示浏览器的完整高度 链接 - https://goo.gl/RG60n1

这是我的HTML -

      <div class="container contentContainer">

            <div class="row">

            <div class="col-md-6 col-md-offset-3" id="topRow">

                <h1>Get Work. Done</h1>

            </div>
        </div>
     </div> 

这里是css -

  .contentContainer
        {
            background-image:url('laptop1.jpg');
            height:400px;
            width:100%;
            background-size:cover;
        }

和jquery -

    <script>

        $(".contentContainer").css("height",$(window).height());

   </script>

我使用的是jQuery 1.11.2 min版本

1 个答案:

答案 0 :(得分:0)

打开jQuery! jsfiddle.net/ntmd7c31

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script‌​>