修改单页滚动功能 - 重叠而不是向上滑动
Modifying onepage scroll functionality - overlap instead of slide up
嗨,我正在使用这个js库来制作一个整页滚动的网站。http://www.thepetedesign.com/demos/onepage_scroll_demo.html
这是我的jsfiddle示例:http://jsfiddle.net/aLjLjxux/
我希望它们保持固定并被以下div 重叠,而不是每个元素都被向上推出身体。此库中是否有此功能的简单实现,或者是否有其他库可以让我实现此目的?
作为参考,它看起来像这样:http://www.facebookgroups.com/,但反转除外。就像后面的div 一样,滚动时会与之前的div 重叠。
<body>
<div class="main">
<section style="background-color: #eaeaea;" class="first"><h1>Hello</h1></section>
<section style="background-color: #dadada;" class="second"><h1>Sup</h1></section>
<section style="background-color: #cacaca;" class="third">yo</section>
</div>
<script type="text/javascript">
$(".main").onepage_scroll({
sectionContainer: "section", // sectionContainer accepts any kind of selector in case you don't want to use section
easing: "ease-out", // Easing options accepts the CSS3 easing animation such "ease", "linear", "ease-in",
// "ease-out", "ease-in-out", or even cubic bezier value such as "cubic-bezier(0.175, 0.885, 0.420, 1.310)"
animationTime: 1000, // AnimationTime let you define how long each section takes to animate
pagination: true, // You can either show or hide the pagination. Toggle true for show, false for hide.
updateURL: false, // Toggle this true if you want the URL to be updated automatically when the user scroll to each page.
beforeMove: function(index) {$(this).css("position", "fixed");}, // This option accepts a callback function. The function will be called before the page moves.
afterMove: function(index) {}, // This option accepts a callback function. The function will be called after the page moves.
loop: false, // You can have the page loop back to the top/bottom when the user navigates at up/down on the first/last page.
keyboard: true, // You can activate the keyboard controls
responsiveFallback: false, // You can fallback to normal page scroll by defining the width of the browser in which
// you want the responsive fallback to be triggered. For example, set this to 600 and whenever
// the browser's width is less than 600, the fallback will kick in.
direction: "vertical" // You can now define the direction of the One Page Scroll animation. Options available are "vertical" and "horizontal". The default value is "vertical".
});
</script>
</body>
谢谢。
您链接的网站正在使用pagePiling.js插件。它甚至支持没有CSS3支持的旧浏览器,不像你想要修改的一页滚动。
无需修改您正在使用的那个。反正不会是那个部落。
如果你想反转它,那么你最好从页面堆积开始.js你的工作量会少得多。
相关文章:
- 带有url的单页网站导航
- 如何照顾CSRF&单页应用程序中不使用cookie的XSS攻击
- 如何使用angularjs构建交互式滚动着陆页
- 通过水平滚动将页眉固定到页面顶部
- 遗漏中间部分的单页点导航
- 单页,滚动网站与固定的动态页脚
- 如何使用jQuery单页滚动插件滚动大页面
- 单页滚动问题
- j查询单页滚动不起作用
- 修改单页滚动功能 - 重叠而不是向上滑动
- 单页滚动可更改图像效果(过渡)
- 整页.js 单页滚动 - 无法在最后一部分之后滚动到页脚
- 单页滚动链接不会在url中显示anker
- jQuery单页滚动,带有指向其他页面的链接
- SVG动画滚动单页网站
- 滚动效果到一个单页网站的不同部分
- 为单页锚的侧边导航动画滚动顶部
- 导航链接在滚动位置改变(单页站点)
- 使单页网站看起来像无限滚动,并以不同的方式加载对象
- 水平单页网站:Mobile-Webkit滚动刷的问题