counters
This commit is contained in:
@@ -319,3 +319,22 @@ a:hover {}
|
|||||||
.float_down {
|
.float_down {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.float_count {
|
||||||
|
float: left;
|
||||||
|
padding-top: 4px;
|
||||||
|
text-shadow: var(--button-shadow) 2px 2px 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.float_count_footer {
|
||||||
|
text-shadow: var(--button-shadow) 2px 2px 1px;
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 800px) {
|
||||||
|
.float_count_footer {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,11 @@ r(function() {
|
|||||||
function create_nav() {
|
function create_nav() {
|
||||||
let navis = document.getElementsByClassName("navigation");
|
let navis = document.getElementsByClassName("navigation");
|
||||||
for (let i = 0; i < navis.length; i++) {
|
for (let i = 0; i < navis.length; i++) {
|
||||||
|
if (navis.length > 10) {
|
||||||
|
// no need to enumerate on small sites.
|
||||||
|
navis[i].appendChild(create_counter(i, navis.length, "float_count"));
|
||||||
|
navis[i].parentElement.appendChild(create_counter(i, navis.length, "float_count_footer"));
|
||||||
|
}
|
||||||
if (i == navis.length - 1) {
|
if (i == navis.length - 1) {
|
||||||
navis[i].appendChild(create_button("up", document.body, 0));
|
navis[i].appendChild(create_button("up", document.body, 0));
|
||||||
continue;
|
continue;
|
||||||
@@ -65,6 +70,13 @@ function create_button(direction, to, next) {
|
|||||||
return container
|
return container
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function create_counter(i, total, class_name) {
|
||||||
|
let container = document.createElement('div');
|
||||||
|
container.classList.add(class_name);
|
||||||
|
container.innerHTML = `${i+1}/${total}`;
|
||||||
|
return container
|
||||||
|
}
|
||||||
|
|
||||||
function is_visible(el, type) {
|
function is_visible(el, type) {
|
||||||
let rect = el.getBoundingClientRect();
|
let rect = el.getBoundingClientRect();
|
||||||
if (type == "fully") {
|
if (type == "fully") {
|
||||||
|
|||||||
Reference in New Issue
Block a user