2016-08-14 7 views
0

ウィンドウのサイズを変更するまでウェイポイントプラグインが正しく動作しません。私は理由を知りませんし、この問題の理由を見つけることができません。 ウィンドウのサイズ変更後、すべてが正しくなりました。ここでウィンドウのサイズが変更されるまでウェイポイントが正しく動作しない

は、私のコードの一部です:ここ

$(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/

答えて

0

私は解決策を見つけました。問題はコード順であった。私はウェイポイントを初期化した後にスライダを初期化しました。高さにはすべてのスライドが含まれているため、$(html).height()パラメータが間違っていました。 私は結論を出しました: "あなたのコードの底部に常にウェイポイントを初期化する"

関連する問題