Skip to content

Commit

Permalink
provide history state to history push/replace
Browse files Browse the repository at this point in the history
  • Loading branch information
fisshy committed Mar 2, 2022
1 parent c8db196 commit 7ed6933
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions modules/mixins/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ const updateHash = (hash, historyUpdate) => {
? curLoc.pathname + curLoc.search + hashToUpdate
: curLoc.pathname + curLoc.search;
historyUpdate
? history.pushState(null, "", urlToPush)
: history.replaceState(null, "", urlToPush);
? history.pushState(history.state, "", urlToPush)
: history.replaceState(history.state, "", urlToPush);

};

const getHash = () => {
Expand Down Expand Up @@ -39,8 +40,8 @@ const scrollOffset = (c, t, horizontal) => {
return c === document
? t.getBoundingClientRect().left + (window.scrollX || window.pageXOffset)
: getComputedStyle(c).position !== "static"
? t.offsetLeft
: t.offsetLeft - c.offsetLeft;
? t.offsetLeft
: t.offsetLeft - c.offsetLeft;
} else {
if (c === document) {
return (
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7ed6933

Please sign in to comment.