简体   繁体   English

在鼠标滚动上滚动100vh部分

[英]Scrolling 100vh sections on mouse scroll

This is a general question, but I'm trying to find some code examples and the term used for this type of behavior and how to implement it. 这是一个普遍的问题,但是我试图找到一些代码示例以及用于这种行为以及如何实现它的术语。

Example: https://pixelheads.nl/ 示例: https//pixelheads.nl/

Each section is fully scrolled into view on scroll. 每个部分都完全滚动到滚动视图中。

Looking to the javascript of the example, we can see that the page works with all the elements, one after the another, but when he puts the command overflow:hidden; 查看示例中的javascript,我们可以看到页面可以使用所有元素,一个接一个,但是当他放置命令overflow:hidden; the page not shows the scroll bar. 该页面未显示滚动条。

To give the effect for all the pages, there is an effect "translate3d" and the page "scrolls". 为了使所有页面都具有效果,有一个效果“ translate3d”和一个页面“ scrolls”。 To show the second page: 要显示第二页:

transform: translate3d(0px, -622px, 0px);

For the third: 第三:

transform: translate3d(0px, -1244px, 0px);

I dont found the command into the page to get the mouse wheel, but you can put a event that will be fired when you scroll the page. 我没有在页面中找到获取鼠标滚轮的命令,但是您可以放置​​一个在滚动页面时将触发的事件。

$("body").bind("mousewheel", function(e)
{
    var delta = e.originalEvent.wheelDelta; // give you the direction
    // here you apply the transform on the page.
});

I'm not sure if this example page is using any framework, but i found this question that can help you, if you dont want to do from the beginning. 我不确定该示例页面是否使用任何框架,但是如果您不想从一开始就发现这个问题可以为您提供帮助。 The library mencioned at this question is the same as Michael Coker commentary (alvarotrigo.com/fullPage). 针对此问题进行过精心策划的图书馆与Michael Coker的评论(alvarotrigo.com/fullPage)相同。

scroll a full page height up or down with jQuery/Javascript 使用jQuery / Javascript上下滚动整页高度

I know that the response is not complete, but can give you some directions. 我知道答复还不完整,但是可以给您一些指示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM