Skip to content

Commit

Permalink
fixes magicScroll when no gap between images (#1957)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheepux authored Jun 28, 2020
1 parent 3801ad4 commit fcdc015
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/web/lib/hakuneko/frontend@classic-dark/pages.html
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@
// Find current image within view
let currentScrollImages = [...images].filter(image => {
let rect = image.getBoundingClientRect();
return (rect.top <= window.innerHeight && rect.bottom >=0);
return (rect.top <= window.innerHeight && rect.bottom >1);
});

// If multiple images filtered, get the first one. If none scroll to the top image
Expand All @@ -552,8 +552,7 @@
} else {
// Find next image
let nextScrollImage = currentScrollImage.nextElementSibling;
if (nextScrollImage)
{
if (nextScrollImage) {
// Scroll to it
nextScrollImage.scrollIntoView({
behavior: 'smooth'
Expand Down
5 changes: 2 additions & 3 deletions src/web/lib/hakuneko/frontend@classic-light/pages.html
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@
// Find current image within view
let currentScrollImages = [...images].filter(image => {
let rect = image.getBoundingClientRect();
return (rect.top <= window.innerHeight && rect.bottom >=0);
return (rect.top <= window.innerHeight && rect.bottom >1);
});

// If multiple images filtered, get the first one. If none scroll to the top image
Expand All @@ -552,8 +552,7 @@
} else {
// Find next image
let nextScrollImage = currentScrollImage.nextElementSibling;
if (nextScrollImage)
{
if (nextScrollImage) {
// Scroll to it
nextScrollImage.scrollIntoView({
behavior: 'smooth'
Expand Down

0 comments on commit fcdc015

Please sign in to comment.