work on start

This commit is contained in:
infeeeee
2019-08-10 03:45:43 +02:00
parent eb6fdf9388
commit 0686d99971
6 changed files with 336 additions and 157 deletions

View File

@@ -363,16 +363,16 @@
//from the third wrap modify the offset
var wNum = parseInt($(nextelem).attr("class").split(" ")[1].split("-")[1])
console.log(wNum)
if (wNum == 3 || !isHome) {
offset = offset - (desktophomemargin /2 )
} else if (wNum > 4 || !isHome) {
if (wNum == 3) {
offset = offset - (desktophomemargin / 2)
} else if (wNum > 3 || !isHome) {
offset = offset - desktophomemargin
}
}
console.log("scrolling to: " + nextelem.attr("class") + " - offset: " + offset)
const scrollspeed = isEsemeny ? 500 : 800
$('html, body, .wrapper').stop().animate({ scrollLeft: offset }, scrollspeed, function () {
//hide the left arrow if on start
@@ -540,7 +540,7 @@
})
$('.misha_loadmore').on("moreload-finish", function () {
$('.misha_loadmore').on("moreload-finish", function (e, scroll) {
//wrap new elements on load
articleWrapCounter++
@@ -551,18 +551,34 @@
$(".home_wrapper-" + wrapnum).addRandomClasses()
//Scroll to new element
currElem = homeScroll(currElem, "next")
if (scroll) {
currElem = homeScroll(currElem, "next")
}
})
/* ----------------------------- loadmore click ----------------------------- */
$('.misha_loadmore').click(function (e) {
e.preventDefault()
loadmore($(this))
});
var touched = false
$('.misha_loadmore')//.click(function (e) {
.on('touchstart', function (e) {
touched = true
})
.on('touchend', function (e) {
touched = false
e.preventDefault()
loadmore($(this), false)
})
.on('mouseup', function (e) {
if (touched) {
return
}
e.preventDefault()
loadmore($(this))
})
var noMoreAjax = false
function loadmore(element) {
function loadmore(element, scroll = true) {
if (noMoreAjax) {
console.log("no more ajax")
return false
@@ -594,7 +610,7 @@
button.html('<a>Mutass többet</a>').before(data); // insert new posts
misha_loadmore_params.current_page++;
button.trigger("moreload-finish")
button.trigger("moreload-finish", scroll)
console.log("loading:", data.length)
// you can also fire the "post-load" event here if you use a plugin that requires it