AJAX页面加载时航点故障

时间:2016-11-01 14:41:36

标签: ajax wordpress offset jquery-waypoints

我希望这是一个已解决的问题。这让我疯了!

我使用Waypoints触发帖子和固定导航。当40%的帖子进入视口时,会在帖子中添加一个类来更改比例,并将类添加到导航中的关联类别以更改不透明度。

如果你去网站,它很棒。但是如果你点击" Wordpress"在导航中,页面将通过AJAX加载。

问题是......当帖子到达应该触发Waypoint的点时,导航被触发但是帖子没有。如果你继续滚动,帖子会触发OPOPOSITE的时间和地点。

我添加了debug.js并收到此错误: 未捕获的TypeError:无法读取属性' Context'未定义的(...) checkWaypointStyles @ debug.js?ver = 20151215:16(匿名函数)@ debug.js?ver = 20151215:38(匿名函数)@ debug.js?

http://portfolio.cairndigitalmedia.com/

//  Waypoint effects on posts   

$('#main > .post:nth-child(even)').waypoint(function() {
$('#main > .post:nth-child(even)').addClass('post-visible'); 
}, {
offset: '60%'
});
$('#main > .post:nth-child(even)').waypoint(function() {
$('#main > .post:nth-child(even)').addClass('post-visible');
}, {
offset: '0%'
});
$('#main > .post:nth-child(even)').waypoint(function() {
$('#main > .post:nth-child(even)').removeClass('post-visible');
}, {
offset: '100%'
}); 
$('#main > .post:nth-child(even)').waypoint(function() {
$('#main > .post:nth-child(even)').removeClass('post-visible');
}, {
offset: '-40%'
});  


$('#main > .post:nth-child(odd)').waypoint(function() {
$('#main > .post:nth-child(odd)').addClass('post-visible');
}, {
offset: '60%'
});
$('#main > .post:nth-child(odd)').waypoint(function() {
$('#main > .post:nth-child(odd)').addClass('post-visible');
}, {
offset: '0%'
});
$('#main > .post:nth-child(odd)').waypoint(function() {
$('#main > .post:nth-child(odd)').removeClass('post-visible');
}, {
offset: '100%'
}); 
$('#main > .post:nth-child(odd)').waypoint(function() {
$('#main > .post:nth-child(odd)').removeClass('post-visible');
}, {
offset: '-40%'
}); 


// Waypoint effects on nav

$('.post.category-wordpress').waypoint(function() {
$('li.wordpress a').addClass('category-visible');
}, {
offset: '60%'
});
$('.post.category-wordpress').waypoint(function() {
$('li.wordpress a').addClass('category-visible');
}, {
offset: '0%'
});
$('.post.category-wordpress').waypoint(function() {
$('li.wordpress a').removeClass('category-visible');
}, {
offset: '70%'
});
$('.post.category-wordpress').waypoint(function() {
$('li.wordpress a').removeClass('category-visible');
}, {
offset: '-40%'
});

0 个答案:

没有答案
相关问题