繁体   English   中英

使用鼠标滚轮和触摸滚动iScroll 5容器边界检测

[英]iScroll 5 container boundaries detection scrolling with mousewheel and touch

我将iScroll 5与fullpage.js一起使用,因为fullpage.js提供的解决方案不是我所需要的。

我的页面有3个完整的页面部分。 第二部分具有垂直可滚动内容。

我需要做的是检测我的可滚动内容何时位于父元素(顶部和底部)的边界内,然后如果再次执行滚动(无论是鼠标滚轮还是触摸),它将触发一个事件。

这是一个摆弄这个问题的小提琴

我需要这样的东西:

$('.scrollwrapper').on("mousewheel touchmove", function() {
    if ("scroll is on max top"){
        $(this).on("wheelUp touchmoveUp", function() {
            $.fn.fullpage.moveSectionUp();
        });
    }else if ("scroll is on max bottom"){
        $(this).on("wheelDown touchmoveDown", function() {
            $.fn.fullpage.moveSectionDown();
        });
    }
});

希望您能帮助我,我将不胜感激。

您可以尝试这样的事情

xpScroll.on('scrollEnd', function(){
    var scrollY = xpScroll.y + 15;
    var scrollH = $('.xp-scroll').height() - $(window).height();
    var scrollEnd = scrollH + scrollY;

    if (scrollEnd == 0) {
        alert('End');
    }
});

http://jsfiddle.net/fF4BJ/1/在您的小提琴中为我工作。 要向上滚动,请使用您的数学技能。

暂无
暂无

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

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