navigation

This commit is contained in:
j 2023-08-23 14:57:57 +02:00
parent cf2efd7fb3
commit 3153402ba9
2 changed files with 34 additions and 25 deletions

View file

@ -203,3 +203,15 @@ nav.overlay {
cursor: pointer;
}
}
.content {
position: relative;
nav.items {
position: absolute;
top: -22px;
right: 0px;
@media(max-width:768px) {
right: 16px;
}
}
}

View file

@ -46,31 +46,6 @@ function renderItem(data) {
if (!item.title) {
div.querySelector('item-title').remove()
}
if (item.next || item.previous) {
var more = div.querySelector('.more')
var nav = document.createElement('nav')
//more.insertBefore(nav, more.firstChild);
more.appendChild(nav)
if (item.previous) {
var a = document.createElement('a')
a.href = item.previous
a.innerText = '<< previous'
nav.appendChild(a)
}
if (item.previous && item.next) {
var e = document.createElement('span')
e.innerText = ' | '
nav.appendChild(e)
}
if (item.next) {
var a = document.createElement('a')
a.href = item.next
a.innerText = 'next >>'
nav.appendChild(a)
}
}
if (window.renderComments) {
renderComments(div.querySelector('.comments'), data)
@ -132,6 +107,28 @@ function renderItem(data) {
})
})
if (item.next || item.previous) {
var nav = document.createElement('nav')
nav.classList.add('items')
if (item.previous) {
var a = document.createElement('a')
a.href = item.previous
a.innerText = '<< previous'
nav.appendChild(a)
}
if (item.previous && item.next) {
var e = document.createElement('span')
e.innerText = ' | '
nav.appendChild(e)
}
if (item.next) {
var a = document.createElement('a')
a.href = item.next
a.innerText = 'next >>'
nav.appendChild(a)
}
div.appendChild(nav)
}
document.querySelector(".content").replaceWith(div)
}