【问题标题】:jQuery Waypoints Not functioning on initial scrolljQuery Waypoints 在初始滚动时不起作用
【发布时间】:2013-01-02 23:42:36
【问题描述】:

当元素在浏览器窗口中居中 50%(或 75%)时,我使用下面的脚本和 jQuery Waypoints plugin 将元素淡化为 100% 不透明度。代码似乎工作得很好,除了元素似乎最初并没有淡入。当我向下滚动然后备份时,它似乎正在触发它们。

$(document).ready(function() {
$('#feature').waypoint(function(event, direction) {
   var targetOpacity = direction === "down" ? 1 : .25;
   $(this).stop().animate({ "opacity": targetOpacity });
}, {
   offset: '50%'
});

$('#footer').waypoint(function(event, direction) {
   var targetOpacity = direction == "down" ? 1 : .25;
   $(this).stop().animate({ "opacity": targetOpacity });
}, {
   offset: '75%' 
});

});

【问题讨论】:

    标签: php javascript jquery jquery-waypoints


    【解决方案1】:

    checkout $.waypoints('refresh') 触发页面加载动作

    【讨论】:

    • 似乎没有解决问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-24
    • 1970-01-01
    相关资源
    最近更新 更多