0
我正在使用Waypoints在用戶向下滾動頁面時切換「live」類的特定菜單項。一切都在工作,只有當下一個區域到達時,「實時」類纔會切換。例如,在達到#服務設施的情況下,#overview菜單項(124)仍具有「實時」類。當到達另一節時,我需要做什麼才能切斷課程。這是我的代碼。謝謝你的幫助。爲什麼我的航點不能正常工作?
<script type="text/javascript">
$(document).ready(function(){
$('#overview').waypoint(function(direction) {
$('#menu-item-124').toggleClass('live', direction === 'down');
});
$('#services-amenities').waypoint(function(direction) {
$('#menu-item-125').toggleClass('live', direction === 'down');
});
$('#destinations').waypoint(function(direction) {
$('#menu-item-126').toggleClass('live', direction === 'down');
});
$('#exceptional-value').waypoint(function(direction) {
$('#menu-item-127').toggleClass('live', direction === 'down');
});
$('#sample-usage').waypoint(function(direction) {
$('#menu-item-128').toggleClass('live', direction === 'down');
});
$('#pricing-license-descriptions').waypoint(function(direction) {
$('#menu-item-129').toggleClass('live', direction === 'down');
});
});
</script>