Skip to content

Commit

Permalink
feat: Trade exponential for fast smooth scrolling
Browse files Browse the repository at this point in the history
implemented by the browser.
Drop jquery.easing as now unused dependency.
  • Loading branch information
AiyionPrime committed Jan 2, 2025
1 parent 7366fd6 commit 36bb91e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 39 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/vendor-integrity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ jobs:
- name: Run build:jquery
run: npm run build:jquery

- name: Run build:jquery.easing
run: npm run build:jquery.easing

- name: Run build:leaflet
run: npm run build:leaflet

Expand Down
3 changes: 0 additions & 3 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,6 @@ <h2>Verwendetes Bild im Kopf der Seite</h2>
<!-- Bootstrap Core JavaScript -->
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>

<!-- Plugin JavaScript -->
<script src="vendor/jquery.easing/jquery.easing.min.js"></script>

<!-- Leaflet -->
<script src="vendor/leaflet/leaflet.js"></script>

Expand Down
3 changes: 0 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,6 @@ <h2>oder via</h2>
<!-- Bootstrap Core JavaScript -->
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>

<!-- Plugin JavaScript -->
<script src="vendor/jquery.easing/jquery.easing.min.js"></script>

<!-- Leaflet -->
<script src="vendor/leaflet/leaflet.js"></script>

Expand Down
36 changes: 20 additions & 16 deletions js/grayscale.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

document.addEventListener("DOMContentLoaded", function () {
const links = document.querySelectorAll("a.page-scroll");
const navbar = document.querySelector(".navbar-custom");

// event listener to collapse the navbar on scroll
Expand All @@ -17,23 +18,26 @@ document.addEventListener("DOMContentLoaded", function () {
navbar.style.backgroundColor = "rgba(0,0,0,1)";
}
});
});

// jQuery for page scrolling feature - requires jQuery Easing plugin
$(function () {
$("a.page-scroll").bind("click", function (event) {
var $anchor = $(this);
$("html, body")
.stop()
.animate(
{
scrollTop: $($anchor.attr("href")).offset().top,
},
1500,
"easeInOutExpo",
);
window.location.href = $anchor.attr("href");
event.preventDefault();
links.forEach(function (link) {
link.addEventListener("click", function (event) {
const href = link.getAttribute("href");

if (!href.startsWith("#")) {
return;
}
event.preventDefault();
const targetId = href.substring(1); // Remove the "#" from href
const targetElement = document.getElementById(targetId);

if (targetElement) {
window.scrollTo({
top: targetElement.offsetTop,
behavior: "smooth",
});
window.location.href = href;
}
});
});
});

Expand Down
8 changes: 0 additions & 8 deletions package-lock.json

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

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"build:dsicons": "./node_modules/svgtofont/lib/cli.js --sources ./node_modules/decentralized-social-icons/src/ --output ./vendor/decentralized-social-icons/ --fontName DSoci",
"build:font-awesome": "rm -rf vendor/font-awesome; mkdir vendor/font-awesome; cp -r node_modules/@fortawesome/fontawesome-free/css/ vendor/font-awesome/css/; cp -r node_modules/@fortawesome/fontawesome-free/webfonts/ vendor/font-awesome/webfonts/;",
"build:jquery": "cp node_modules/jquery/dist/jquery.min.js vendor/jquery/jquery.min.js",
"build:jquery.easing": "cp node_modules/jquery.easing/jquery.easing.min.js vendor/jquery.easing/",
"build:leaflet": "rm -rf vendor/leaflet; cp -r node_modules/leaflet/dist/ vendor/leaflet/",
"build:lora": "rm -rf vendor/@fontsource/lora/; mkdir -p vendor/@fontsource/; cp -r node_modules/@fontsource/lora/ vendor/@fontsource/lora/; cat vendor/@fontsource/lora/400.css vendor/@fontsource/lora/700.css vendor/@fontsource/lora/400-italic.css vendor/@fontsource/lora/700-italic.css > vendor/@fontsource/lora/400_700_400italic_700italic.css",
"build:montserrat": "rm -rf vendor/@fontsource/montserrat/; mkdir -p vendor/@fontsource/; cp -r node_modules/@fontsource/montserrat/ vendor/@fontsource/montserrat/; cat vendor/@fontsource/montserrat/400.css vendor/@fontsource/montserrat/700.css > vendor/@fontsource/montserrat/400_700.css",
Expand All @@ -32,7 +31,6 @@
"bootstrap": "^5.3.3",
"decentralized-social-icons": "git+https://codeberg.org/WeDistribute/decentralized-social-icons.git",
"jquery": "^3.7.1",
"jquery.easing": "^1.4.1",
"leaflet": "^1.9.4",
"less": "^4.2.1",
"prettier": "^3.4.2",
Expand Down
3 changes: 0 additions & 3 deletions satzung.html
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,6 @@ <h3>§ 13 Auflösung des Vereins und Anfallberechtigung</h3>
<!-- Bootstrap Core JavaScript -->
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>

<!-- Plugin JavaScript -->
<script src="vendor/jquery.easing/jquery.easing.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="js/grayscale.js"></script>
</body>
Expand Down
1 change: 0 additions & 1 deletion vendor/jquery.easing/jquery.easing.min.js

This file was deleted.

0 comments on commit 36bb91e

Please sign in to comment.