mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
Fix jumpUp button
Switch to reffere instead of src url Once again, I am changing animations
This commit is contained in:
parent
f845f614df
commit
a9b13f1e39
7 changed files with 38 additions and 22 deletions
|
@ -45,13 +45,13 @@
|
|||
loadOnView();
|
||||
};
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const src = urlParams.get('src');
|
||||
if (src) {
|
||||
var imgOffset = document.getElementById('image-' + src).offsetTop;
|
||||
var imgHeight = document.getElementById('image-' + src).offsetHeight;
|
||||
if (document.referrer.includes('image')) {
|
||||
var referrerId = document.referrer.split('/').pop();
|
||||
|
||||
var imgOffset = document.getElementById('image-' + referrerId).offsetTop;
|
||||
var imgHeight = document.getElementById('image-' + referrerId).offsetHeight;
|
||||
var windowHeight = window.innerHeight;
|
||||
|
||||
|
||||
document.querySelector('html').style.scrollBehavior = 'auto';
|
||||
window.scrollTo(0, imgOffset + (imgHeight / 2) - (windowHeight / 2));
|
||||
document.querySelector('html').style.scrollBehavior = 'smooth';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue