gpt4 book ai didi

javascript - Foundation - Off Canvas 滚动问题

转载 作者:搜寻专家 更新时间:2023-10-31 22:28:08 25 4
gpt4 key购买 nike

我从 Foundation 开始,并尝试让 Canvas 外的示例正常工作。我一直在努力,因为菜单会像它应该的那样打开和关闭,但是如果页面内容很长并且你滚动到底部,当你打开菜单时,焦点就是你在页面上的位置。 IE,固定的工具栏和菜单打开时不固定。

我已经在 fiddle 上做了一个例子,希望得到一些帮助!

JSFiddle Example

HTML

<div class="off-canvas-wrap" data-offcanvas="">
<div class="inner-wrap">
<div class="fixed">
<nav class="tab-bar">
<section class="left-small">
<a class="left-off-canvas-toggle menu-icon" href="#"><span></span></a>
</section>

<section class="middle tab-bar-section">
<h1 class="title">Forest School - PARS Insight</h1>
</section>
</nav>
</div>

<aside class="left-off-canvas-menu">
<ul class="off-canvas-list">
<li><label>General</label></li>
<li><a href="#">Snapshot</a></li>
<li><a href="#">Timetable</a></li>
<li><a href="#">Homework</a></li>
</ul>
</aside>
Long Body Content Here

CSS

.off-canvas-wrap, .inner-wrap {
min-height: 100%;
}

.off-canvas-wrap{
height: 100%;
overflow-y: auto;
}

Javascript

$(document).foundation();

最佳答案

这是非常受欢迎的基金会问题:

http://foundation.zurb.com/forum/posts/965-fixed-menu-using-offcanvas
http://foundation.zurb.com/forum/posts/547-off-canvas-with-fixed-top-bar
https://github.com/zurb/foundation/issues/3863
https://github.com/zurb/foundation/issues/3710

尽管官方解决方案似乎不存在,但我找到了this one ( reference ) 看起来可以很好地解决您的问题。

HTML

<div class="off-canvas-wrap">
<div class="inner-wrap">
<div class="header">
<nav class="tab-bar" data-offcanvas>
<section class="left-small">
<a class="left-off-canvas-toggle menu-icon">
<span></span>
</a>
</section>
<section class="right tab-bar-section">
<h1>Foundation 5 test</h1>
</section>
</nav>
</div>
<aside class="left-off-canvas-menu">
<ul class="off-canvas-list">
<li>
<label>Foundation</label>
</li>
[...]
<li><a href="#">The Psychohistorians</a>
[...]
</li>
</ul>
</aside>
<article class="small-12 columns">
<p>Content</p>
<p>Content</p>
<div data-magellan-expedition="fixed">
<dl class="sub-nav panel">
<dd data-magellan-arrival="build">
<a href="#build">Build with HTML</a>
</dd>
<dd data-magellan-arrival="js">
<a href="#js">Arrival 2</a>
</dd>
</dl>
</div>
[...]
<p>Content</p>
[...]
</article>
<a class="exit-off-canvas"></a>
<footer class="small-12 columns">
<div>...</div>
</footer>
</div>
</div>

CSS

article {
overflow-y: auto;
}
article,
body,
html,
.off-canvas-wrap,
.off-canvas-wrap .inner-wrap,
.row {
height: 100%;
width: 100%;
}
.header {
position: absolute;
top: 0;
width: 100%;
z-index: 99;
}

关于javascript - Foundation - Off Canvas 滚动问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28112863/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com