【问题标题】:Scrolling with fullpagejs over fixed elements使用 fullpagejs 在固定元素上滚动
【发布时间】:2015-04-07 14:16:51
【问题描述】:

我正在尝试使用 fullpage.js 设计一个网站,其中包含覆盖部分屏幕的固定元素。问题是当鼠标悬停在这些固定元素上时,滚动无法正常工作(参见jsfiddle example

这是我的html:

<div class="hider" style="top: 0"></div>
<div id="fullpage">
    <div class="section">Section 1</div>
    <div class="section">Section 2</div>
    <div class="section">Section 3</div>
</div>
<div class="hider" style="bottom: 0"></div>

这是我的 CSS:

body {
    text-align: center;
}
.section {
    font-size: 32px;
    background-color: #b3d4fc;
}
.hider {
    width: 100%;
    height: calc(50% - 20px);
    background-color: #3461ff;
    position: fixed;
    z-index: 1;
}

我希望能够在鼠标悬停在固定元素上时滚动,并且智能手机或平板电脑用手指在固定 div 上向上或向下滑动。我该怎么做?

【问题讨论】:

    标签: javascript html css fullpage.js


    【解决方案1】:

    只需将固定元素放在整页 div 中即可。

    <div id="fullpage">
        <div class="hider" style="top: 0"></div>
        <div class="section">Section 1</div>
        <div class="section">Section 2</div>
        <div class="section">Section 3</div>
        <div class="hider" style="bottom: 0"></div>
    </div>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-10-14
      • 2019-01-13
      • 2020-05-09
      • 1970-01-01
      • 2012-03-12
      • 2018-12-28
      • 2018-11-27
      • 2011-10-21
      相关资源
      最近更新 更多