mirror of
https://github.com/openvk/openvk
synced 2024-12-24 17:41:07 +03:00
Fix scroll
This commit is contained in:
parent
8bccab7bc0
commit
553731deed
3 changed files with 20 additions and 5 deletions
|
@ -51,7 +51,7 @@
|
|||
{include "../components/paginator.xml", conf => $paginatorConf}
|
||||
{/if}
|
||||
|
||||
<script>
|
||||
<script n:if="$thisUser->getPaginatorType() == 0">
|
||||
u("#pageSelect").nodes[0].value = {$paginatorConf->perPage};
|
||||
|
||||
u("#pageSelect").on("change", function(e) {
|
||||
|
|
|
@ -272,9 +272,11 @@ async function showArticle(note_id) {
|
|||
|
||||
$(document).on("click", ".showMore", async (e) => {
|
||||
e.currentTarget.innerHTML = `<img id="loader" src="/assets/packages/static/openvk/img/loading_mini.gif">`
|
||||
|
||||
let url = new URL(location.href)
|
||||
let newPage = Number(e.currentTarget.dataset.page) + 1
|
||||
url.searchParams.set("p", newPage)
|
||||
url.searchParams.set("posts", 10)
|
||||
|
||||
let xhr = new XMLHttpRequest
|
||||
xhr.open("GET", url)
|
||||
|
@ -328,3 +330,20 @@ $(document).on("click", ".showMore", async (e) => {
|
|||
|
||||
xhr.send()
|
||||
})
|
||||
|
||||
let showMoreObserver = new IntersectionObserver(entries => {
|
||||
entries.forEach(x => {
|
||||
if(x.isIntersecting) {
|
||||
$(".showMore").click()
|
||||
}
|
||||
})
|
||||
}, {
|
||||
root: null,
|
||||
rootMargin: "0px",
|
||||
threshold: 0
|
||||
})
|
||||
|
||||
let showMore = document.querySelector('.showMore');
|
||||
|
||||
if(showMore != null)
|
||||
showMoreObserver.observe(showMore);
|
||||
|
|
|
@ -691,8 +691,4 @@ $(document).on("scroll", () => {
|
|||
$(".floating_sidebar")[0].classList.remove("hide_anim");
|
||||
}, 250);
|
||||
}
|
||||
|
||||
if($(window).scrollTop() == $(document).height() - $(window).height() && document.querySelector(".showMore") != null) {
|
||||
$(".showMore").click()
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue