Skip to content

Commit

Permalink
fix offset
Browse files Browse the repository at this point in the history
  • Loading branch information
denniserdmann committed Jul 5, 2022
1 parent a77e0c0 commit 52d380b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Resources/public/onepage_navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Onepage(list, options) {
const pushUrl = options.pushUrl || false;
const offset = parseInt(options.offset, 10) || 0;

const offsetArray = Number(offset) - 100 + '% 0% '+ Number(-offset) + '% 0%';
const offsetArray = Number(-offset) + '% 0% '+ Number(-offset) + '% 0%';
const el = document.querySelectorAll('a[href*="#"]:not([href="#"]):not([href="#0"])');
const uri = window.location.href.split("#")[0];

Expand Down Expand Up @@ -49,7 +49,7 @@ function Onepage(list, options) {
if (actualItem) {
// add active status when scrolling down
actualItem.classList.add('active');
} else if(active != null) {
} else if (active != null) {
// active status to previous list item when scrolling up AND active article is not in nav
article = getPreviousSibling(document.querySelector('#'+ article), '.onepage_article');
actualItem = list.querySelector('li[data-onepage-link="'+ article.id +'"]');
Expand Down

0 comments on commit 52d380b

Please sign in to comment.