mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-01-04 05:46:14 +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
|
@ -1,15 +1,17 @@
|
||||||
let navToggle = true;
|
let navToggle = true;
|
||||||
|
|
||||||
document.onscroll = function() {
|
document.onscroll = function() {
|
||||||
|
try {
|
||||||
document.querySelector('.background-decoration').style.opacity = `${1 - window.scrollY / 621}`;
|
document.querySelector('.background-decoration').style.opacity = `${1 - window.scrollY / 621}`;
|
||||||
document.querySelector('.background-decoration').style.top = `-${window.scrollY / 5}px`;
|
document.querySelector('.background-decoration').style.top = `-${window.scrollY / 5}px`;
|
||||||
|
} catch (e) {
|
||||||
|
console.log('No background decoration found');
|
||||||
|
}
|
||||||
|
|
||||||
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) {
|
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) {
|
||||||
document.querySelector('.jumpUp').style.opacity = 1;
|
document.querySelector('.jumpUp').classList = 'jumpUp jumpUp--show';
|
||||||
document.querySelector('.jumpUp').style.right = "0.75rem";
|
|
||||||
} else {
|
} else {
|
||||||
document.querySelector('.jumpUp').style.opacity = 0;
|
document.querySelector('.jumpUp').classList = 'jumpUp';
|
||||||
document.querySelector('.jumpUp').style.right = "-3rem";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
<span></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scrollPosition %}?src={{ image['id'] }}{% endblock %}
|
|
||||||
{% block wrapper_class %}image-wrapper{% endblock %}
|
{% block wrapper_class %}image-wrapper{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -209,10 +208,15 @@
|
||||||
|
|
||||||
{% block script %}
|
{% block script %}
|
||||||
<script>
|
<script>
|
||||||
var collapseButton = document.querySelectorAll('#collapse-info');
|
var infoCollapse = document.querySelectorAll('#collapse-info');
|
||||||
|
for (var i = 0; i < infoCollapse.length; i++) {
|
||||||
for (var i = 0; i < collapseButton.length; i++) {
|
infoCollapse[i].addEventListener('click', function() {
|
||||||
collapseButton[i].addEventListener('click', function() {
|
this.parentNode.classList.toggle('image-info__collapsed');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var infoHeader = document.querySelectorAll('.image-info__header');
|
||||||
|
for (var i = 0; i < infoHeader.length; i++) {
|
||||||
|
infoHeader[i].addEventListener('click', function() {
|
||||||
this.parentNode.classList.toggle('image-info__collapsed');
|
this.parentNode.classList.toggle('image-info__collapsed');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,11 @@
|
||||||
loadOnView();
|
loadOnView();
|
||||||
};
|
};
|
||||||
|
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
if (document.referrer.includes('image')) {
|
||||||
const src = urlParams.get('src');
|
var referrerId = document.referrer.split('/').pop();
|
||||||
if (src) {
|
|
||||||
var imgOffset = document.getElementById('image-' + src).offsetTop;
|
var imgOffset = document.getElementById('image-' + referrerId).offsetTop;
|
||||||
var imgHeight = document.getElementById('image-' + src).offsetHeight;
|
var imgHeight = document.getElementById('image-' + referrerId).offsetHeight;
|
||||||
var windowHeight = window.innerHeight;
|
var windowHeight = window.innerHeight;
|
||||||
|
|
||||||
document.querySelector('html').style.scrollBehavior = 'auto';
|
document.querySelector('html').style.scrollBehavior = 'auto';
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
{% block header %}{% endblock %}
|
{% block header %}{% endblock %}
|
||||||
|
|
||||||
<div class="navigation">
|
<div class="navigation">
|
||||||
<a href="{{url_for('gallery.index')}}{% block scrollPosition %}{% endblock %}" class="navigation-item {% block nav_home %}{% endblock %}">
|
<a href="{{url_for('gallery.index')}}" class="navigation-item {% block nav_home %}{% endblock %}">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 24 24" width="24" fill="currentColor">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 24 24" width="24" fill="currentColor">
|
||||||
<path d="M2 8v10h12V8H2zm2-2V2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-2v4a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2zm2 0h8a2 2 0 0 1 2 2v4h2V2H6v4zm0 9a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"></path><path d="M7 6a3 3 0 1 1 6 0h-2a1 1 0 0 0-2 0H7zm1.864 13.518l2.725-4.672a1 1 0 0 1 1.6-.174l1.087 1.184 1.473-1.354-1.088-1.183a3 3 0 0 0-4.8.52L7.136 18.51l1.728 1.007zm6.512-12.969a2.994 2.994 0 0 1 3.285.77l1.088 1.183-1.473 1.354-1.087-1.184A1 1 0 0 0 16 8.457V8c0-.571-.24-1.087-.624-1.451z"></path>
|
<path d="M2 8v10h12V8H2zm2-2V2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-2v4a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2zm2 0h8a2 2 0 0 1 2 2v4h2V2H6v4zm0 9a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"></path><path d="M7 6a3 3 0 1 1 6 0h-2a1 1 0 0 0-2 0H7zm1.864 13.518l2.725-4.672a1 1 0 0 1 1.6-.174l1.087 1.184 1.473-1.354-1.088-1.183a3 3 0 0 0-4.8.52L7.136 18.51l1.728 1.007zm6.512-12.969a2.994 2.994 0 0 1 3.285.77l1.088 1.183-1.473 1.354-1.087-1.184A1 1 0 0 0 16 8.457V8c0-.571-.24-1.087-.624-1.451z"></path>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
|
@ -7,10 +7,13 @@
|
||||||
@keyframes notificationTimeout
|
@keyframes notificationTimeout
|
||||||
0%
|
0%
|
||||||
left: -100%
|
left: -100%
|
||||||
opacity: 1
|
height: 3px
|
||||||
90%
|
90%
|
||||||
left: 0%
|
left: 0%
|
||||||
opacity: 1
|
height: 3px
|
||||||
|
95%
|
||||||
|
left: 0%
|
||||||
|
height: 0
|
||||||
100%
|
100%
|
||||||
left: 0%
|
left: 0%
|
||||||
opacity: 0
|
height: 0
|
||||||
|
|
|
@ -27,3 +27,11 @@
|
||||||
&:hover
|
&:hover
|
||||||
background-color: $black
|
background-color: $black
|
||||||
color: $primary
|
color: $primary
|
||||||
|
|
||||||
|
.jumpUp--show
|
||||||
|
right: 0.75rem
|
||||||
|
opacity: 1
|
||||||
|
|
||||||
|
@media (max-width: $breakpoint)
|
||||||
|
.jumpUp
|
||||||
|
bottom: 4.25rem
|
||||||
|
|
|
@ -90,7 +90,6 @@
|
||||||
left: 0px
|
left: 0px
|
||||||
|
|
||||||
background-color: $white
|
background-color: $white
|
||||||
opacity: 0
|
|
||||||
|
|
||||||
animation: notificationTimeout 5.1s linear
|
animation: notificationTimeout 5.1s linear
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue