【问题标题】:waypoints don't work correctly until window resized在调整窗口大小之前,航点无法正常工作
【发布时间】:2016-08-14 08:44:30
【问题描述】:

在我调整窗口大小之前,Waypoints 插件无法正常工作。我不知道为什么,也找不到这个问题的原因。 调整窗口大小后一切正常。

这是我的代码的一部分:

$(function)(){
//menu active change while scroll
var about_us = $("section.about-us");
waypoints = about_us.waypoint(function(direction){

    console.log("about_us section");
    changeActiveMenu("about_us-menu");

    if (direction === 'down') {
        $(".to-top").addClass("show");
        console.log("show-to-top");
    }else if (direction === 'up') {
        $(".to-top").removeClass("show");
        console.log("hide-to-top");
    }

},{
    offset: "30%"
});


var building = $("section.building");
waypoints = building.waypoint(function(){
    console.log("building section");

    changeActiveMenu("building-menu", "service-menu");
},{
    offset: "30%"
});
});

这是一个有问题的链接:http://sandbox.maximshadrin.ru/aquanomika/

【问题讨论】:

    标签: jquery-waypoints


    【解决方案1】:

    我找到了解决方案。问题出在代码顺序上。在初始化航路点和 $(html).height() 参数错误后,我被初始化了滑块,因为高度包含所有幻灯片(一个在另一个而不是在左侧旁边的一个)。 所以我得出结论:“始终在代码底部初始化航点”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-09
      • 1970-01-01
      • 2012-05-16
      • 1970-01-01
      • 1970-01-01
      • 2020-07-01
      相关资源
      最近更新 更多