簡體   English   中英

100%高度div與JQuery頁面滾動器

[英]100% height div with JQuery Page Scroller

我有一個網頁,內部有五個不同的div的包裝,並且我使用查詢PageScroller進行滾動導航,因此頁面彼此上下堆疊。 我的問題是,當我看着一個“頁面”時,我可以看到下面的“頁面”的頂部,如何使這些div占據可見空間的100%? (僅高度)

<div id="wrapper">
    <div id="main">
        <div id="page 1" class="section"> Content here </div>
        <div id="page 2" class="section"> Content here </div>
        <div id="page 3" class="section"> Content here </div>
        <div id="page 4" class="section"> Content here </div>
        <div id="page 5" class="section"> Content here </div>
    </div>
</div>

這就是HTML的設置,單擊導航時,jquery使用類“ section”滾動到該div。

任何幫助將非常感激

謝謝

$(window).ready(function()
{
   var viewport_height = parseInt($(window).height());
   //stringify
   viewport_height = viewport_height + '';
   viewport_height += 'px';

   $(".section").css("height", viewport_height);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM