Zurb Foundation粘性问题:如果我添加底部锚点,则停止工作

时间:2018-01-31 03:34:12

标签: zurb-foundation sticky

我正在尝试在Zurb Foundation 6.4.3单页网站中实现使用sticky的Advanced方法。我的所有组件都是最新的。

在我添加指示的data-btm-anchor代码之前,情况正常:如果我添加了该代码(无论我在我的页面上定位的ID是什么,也不是我的目标是' s:top或:bottom),粘性停止工作(什么都没有)。

其他人在使用data-btm-anchor时遇到问题?它似乎很简单,但对我来说却不起作用。

目标:左右3列各包含一个装饰多边形,作为中心18列的边框(我使用24列网格);中心18包含我的文字。整个部分具有固定的高度(例如,60vh,但实际上每个断点调整实际尺寸)和overflow-y设置为滚动。这个想法是边界多边形静止不动,而中心文本区域滚动,直到我们到达该文本区域的末尾,此时粘性版本和整个页面继续滚动。应该很简单吧?

下面是我的HTML。忽略实际内容(文本),因为它只是占位符;它是div和相关的重要事项。我将从我想要粘贴的行(div)开始,因为它是数据顶部锚点;我想要粘贴的div下面有一个服务ID。再一次,我尝试使用我的数据-btm-anchor ="服务:top"并尝试了data-btm-anchor =" slantsText:bottom&#34 ;;还尝试使用我的页脚ID来测试。无论我使用什么ID作为我的data-btm-anchor,粘滞都停止了工作。

注意:我的最终结束分数会从我在下面粘贴的内容中剔除。在我的实际代码中,所有结束的div都存在(在我注意到的位置后为2"关闭倾斜")。

<div id="cta">
      <div class="grid-container">
          <div class="grid-x align-center">
              <div class="small-20 medium-16 cell">
                  <div class="grid-x grid-padding-x bodyRow">
                      <div class="small-24 cell">
                        <h2>Sign with IHI</h2>
                        <p>Let’s talk about your industrial and  retail space needs <br class="show-for-medium">and our local markets that&nbsp;await&nbsp;you.</p>
                          <div class="text-center">
                              <div id="schedule">
                                  <h6><a href="#/" class="secondary button btnStroked bPr" data-toggle="nPr" aria-controls="nPr">Schedule Your Meeting</a></h6>
                              </div>
                          </div>
                      </div>
                  </div>
              </div>
          </div>
      </div>
  </div><!--close cta-->
<div data-sticky-container>
   <div data-sticky data-margin-top="0" data-top-anchor="cta:bottom" data-btm-anchor="services:top">
  <div id="slants">
      <div class="grid-x align-center">
          <div class="small-3 medium-4 cell slantPolyL"></div>
          <div class="small-18 medium-16 cell slantsTextContainer">
              <div class="grid-container">
                  <div class="grid-x grid-padding-x bodyRow align-center">
                      <div id="slantsText" class="small-23 medium-18 cell">
                          <h2>Sign with IHI</h2>
                          <p>Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.</p>
                          <p>Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.</p>
                          <p>Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.</p>
                          <p>Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.</p>
                          <p>Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.</p>
                          <p>Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.</p>
                          <p>Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.</p>
                          <p>Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.</p>
                          <p>Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.</p>
                          <p>Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.</p>
                          <p>Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.</p>
                          <p>Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.  Let’s talk about your industrial and/or retail space needs in light of our local markets that&nbsp;await&nbsp;you.</p>
                      </div>
                  </div>
              </div>
          </div>
          <div class="small-3 medium-4 cell slantPolyR"></div>
      </div>
   </div><!--close slants-->
</div>

1 个答案:

答案 0 :(得分:0)

这是最奇怪的事情:如果我在id =&#34; services&#34;中的一个单元格中添加ID,它就可以了!例如,如果我使用我的数据粘性数据-btm-anchor =&#34; test:top&#34;然后,在我的id =&#34;服务&#34;添加一个id =&#34; test&#34;,该id有效(而data,btm-anchor =&#34; services:top&#34;不会):

<!--reopen contained grid container-->
<div id="services" class="grid-container">

    <div class="grid-x grid-padding-x bodyRow2 align-center">
        <div id="test" class="small-8 medium-6 large-4 cell redEmphH"></div>
    </div>

ID是否需要在单元格上,而不是在例如div上的类=&#34; grid-container&#34;?