【问题标题】:Make waypoint fire when bottom of element scrolls up into view当元素底部向上滚动到视图中时使航点触发
【发布时间】:2014-08-27 14:24:29
【问题描述】:

如果我想在元素滚动up 进入视野时立即触发航路点怎么办?当您向下滚动时,我有一个航点发生。这很好用。但我希望元素滚动回视图(屏幕底部的元素顶部)后立即触发另一个航路点。

$(".picture").waypoint(function(direction){
            var $this = $(this);
            if (direction === "down") {
                setTimeout(function()
                    {
                        $this.children('.cutline_background').animate({"left":"0px"},2500, function(){});
                        $this.children('.text').animate({"left":"40px"},2500, function(){});
                    }, 3000);

            } 
    }, {offset: 0 });
    $(".picture").waypoint(function(direction){
            var $this = $(this);
            if (direction === "up") {
                $this.children('.cutline_background').css("left", "-20%");  
                $this.children('.text').css("left", "-20%");

            } 
    }, {offset: '90%' }); //this doesn't seem to be working

【问题讨论】:

  • 在这里,我用你的方法创建了一个jsfiddle - 有什么问题?
  • 我猜它似乎不适用于我的网站。也许还有另一个原因。谢谢!

标签: jquery offset jquery-waypoints


【解决方案1】:

Waypoints 有一个偏移别名:bottom-in-view

$('.thing').waypoint(function(direction) {
  // do things
}, {
  offset: 'bottom-in-view'
})

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-09-25
    • 1970-01-01
    • 1970-01-01
    • 2022-12-04
    • 1970-01-01
    • 1970-01-01
    • 2011-08-13
    相关资源
    最近更新 更多