Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 隐藏溢出时滚动元素_Javascript_Html_Reactjs_Web Applications_Custom Scrolling - Fatal编程技术网

Javascript 隐藏溢出时滚动元素

Javascript 隐藏溢出时滚动元素,javascript,html,reactjs,web-applications,custom-scrolling,Javascript,Html,Reactjs,Web Applications,Custom Scrolling,我目前正在寻找关于如何构建所有这些现代网络应用程序的帮助。他们似乎有溢出隐藏,仍然动画元素在各个方向的滚动 我喜欢并使用的示例页面: & 我尝试使用以下方法构建类似的内容: componentDidMount() { var scrollDepth = 0; $(window).bind("mousewheel DOMMouseScroll", function(event) { if ( event.originalEvent.wheelDelt

我目前正在寻找关于如何构建所有这些现代网络应用程序的帮助。他们似乎有溢出隐藏,仍然动画元素在各个方向的滚动

我喜欢并使用的示例页面: &

我尝试使用以下方法构建类似的内容:

 componentDidMount() {
    var scrollDepth = 0;
    $(window).bind("mousewheel DOMMouseScroll", function(event) {
      if (
        event.originalEvent.wheelDelta < 0 ||
        event.originalEvent.detail > 0
      ) {
        var onScrollDown = setTimeout(function() {
          scrollDepth = scrollDepth + 1;
          this.onScrollDown;
        }, 10);
      } else {
        var onScrollUp = setTimeout(function() {
          scrollDepth = scrollDepth - 1;
          this.onScrollUp;
          console.log(scrollDepth);
        }, 10);
      }
    });
componentDidMount(){
var scrollDepth=0;
$(窗口).bind(“mousewheel-DOMMouseScroll”,函数(事件){
如果(
event.originalEvent.wheelDelta<0||
event.originalEvent.detail>0
) {
var onScrollDown=setTimeout(函数(){
scrollDepth=scrollDepth+1;
这是一本书;
}, 10);
}否则{
var onScrollUp=setTimeout(函数(){
scrollDepth=scrollDepth-1;
这是我的错;
console.log(滚动深度);
}, 10);
}
});
但是我想每秒多次计算scrollDepth对帧率来说是非常糟糕的

是否有一种库或更简单/更有效的方法可以通过滚动来移动元素,而无需滚动条


感谢您的帮助

您必须创建容器的水平滚动,您可以在教程中看到:

您可以隐藏滚动条。