Error when scrolling to top of the page
operatorone opened this issue · 7 comments
When I scroll to the top of the page I'll get an error in the console and the .active class in the navigation stops working:
Uncaught TypeError: Cannot read property 'element' of null
at Waypoint.$section.waypoint.offset [as callback] ((index):915)
at Waypoint.trigger (jquery.waypoints.js:59)
at Group.flushTriggers (jquery.waypoints.js:531)
at Context.handleScroll (jquery.waypoints.js:308)
at scrollHandler (jquery.waypoints.js:251)
$section.waypoint.offset @ (index):915
Waypoint.trigger @ jquery.waypoints.js:59
Group.flushTriggers @ jquery.waypoints.js:531
Context.handleScroll @ jquery.waypoints.js:308
scrollHandler @ jquery.waypoints.js:251
requestAnimationFrame (async)
Waypoint.requestAnimationFrame @ jquery.waypoints.js:476
(anonymous) @ jquery.waypoints.js:258
dispatch @ 6f03d58933ec.js:3
r.handle @ 6f03d58933ec.js:3
The line navActive(previousWaypoint.element.id); causes the error in the following section.
$section.waypoint(function(direction) {
if (direction === 'up') {
var previousWaypoint = this.previous();
if($(this.element).hasClass('onepage_article')) {
// change url to active link
navActive(this.element.id);
history.pushState("", "", '#' + this.element.id);
} else {
navActive(previousWaypoint.element.id);
history.pushState("", "", '#' + previousWaypoint.element.id);
}
}
Can you send me the link to your project via email? contao@erdmann-freunde.de
I can confirm that. any fix on this issue yet?
@wschwaiger Can you send me the link to your project via email? contao@erdmann-freunde.de
I have the same issue under Contao 4.9.5, any fixes in sight?
@Ainschy Can you send me the link to your project via email? contao@erdmann-freunde.de
Got a lot of „same here“, but when i checked it, it was another error that caused it.
Dank eines anderen Issues und der Erwähnung des Dev-Branchs konnte ich mein Problem beheben.
https://github.com/ErdmannFreunde/contao-onepage-navigation/issues/12#issuecomment-487466191
I had the same Problem, (Updated from 3.5 to 4.9, installed this Plugin, because the other was to old).
I Overwritten the Manger Installation with Dev State and File /master/src/Hooks/OnepageHooks.php.
It's Work.
The Page Layout is, one Normal Navigation and under the OnePageNavigation.