Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Fix for issue iamdustan#45-- don't try and scroll a position:fixed el…
Browse files Browse the repository at this point in the history
…ement into view
  • Loading branch information
Andre Asselin committed May 6, 2017
1 parent 9da17b4 commit c93b525
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/smoothscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,14 @@
scrollableParent.scrollLeft + clientRects.left - parentRects.left,
scrollableParent.scrollTop + clientRects.top - parentRects.top
);
// reveal parent in viewport
w.scrollBy({
left: parentRects.left,
top: parentRects.top,
behavior: 'smooth'
});
if (w.getComputedStyle(scrollableParent).position != 'fixed') {
// reveal parent in viewport
w.scrollBy({
left: parentRects.left,
top: parentRects.top,
behavior: 'smooth'
});
}
} else {
// reveal element in viewport
w.scrollBy({
Expand Down

0 comments on commit c93b525

Please sign in to comment.