mirror of
https://github.com/Theodor-Springmann-Stiftung/jacoblenz.git
synced 2025-11-01 02:35:34 +00:00
Cursor-Placement (TODO:, mobile, bilder, pdf)
This commit is contained in:
@@ -81,6 +81,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
function isInViewport(element) {
|
||||
const rect = element.getBoundingClientRect();
|
||||
return (
|
||||
rect.top >= 0 &&
|
||||
rect.left >= 0 &&
|
||||
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
|
||||
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
|
||||
);
|
||||
}
|
||||
|
||||
// Scripts for filtering lists
|
||||
let dictionary = [];
|
||||
let categories = [];
|
||||
@@ -272,7 +282,11 @@
|
||||
categories = document
|
||||
.getElementById("list")
|
||||
.getElementsByClassName("category");
|
||||
{# $("input[name='keyword']").focus(); #}
|
||||
|
||||
var searchinput = document.querySelector("input[name='keyword']");
|
||||
if (searchinput !== null && isInViewport(searchinput)) {
|
||||
$("input[name='keyword']").focus();
|
||||
}
|
||||
$("input[name='keyword']").keyup(search);
|
||||
|
||||
// Scrolling & List updating
|
||||
@@ -289,7 +303,7 @@
|
||||
window.onscroll = function () {
|
||||
var scrollPosition = document.documentElement.scrollTop || document.body.scrollTop;
|
||||
for (i in sections) {
|
||||
if (sections[i] <= scrollPosition) {
|
||||
if (sections[i] <= scrollPosition + 60) {
|
||||
var opt = select.querySelector('option[value="#' + i + '"]');
|
||||
if (opt !== null) {
|
||||
opt.selected = true;
|
||||
|
||||
Reference in New Issue
Block a user