mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-26 06:57:04 +01:00
A hacky delay to scroll page to bottom hopefully after media loads
This commit is contained in:
parent
f723259f2f
commit
ec80761a5f
@ -70,6 +70,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://stackoverflow.com/questions/2956966/javascript-telling-setinterval-to-only-fire-x-amount-of-times
|
||||||
|
function setIntervalX(callback, delay, repetitions) {
|
||||||
|
var x = 0;
|
||||||
|
var intervalID = window.setInterval(function () {
|
||||||
|
|
||||||
|
callback();
|
||||||
|
|
||||||
|
if (++x === repetitions) {
|
||||||
|
window.clearInterval(intervalID);
|
||||||
|
}
|
||||||
|
}, delay);
|
||||||
|
}
|
||||||
|
|
||||||
String.prototype.replaceAll = function(target, replacement) {
|
String.prototype.replaceAll = function(target, replacement) {
|
||||||
return this.split(target).join(replacement);
|
return this.split(target).join(replacement);
|
||||||
};
|
};
|
||||||
@ -1553,14 +1566,18 @@
|
|||||||
} else {
|
} else {
|
||||||
if (getParameterByName("scrollbartheme")) {
|
if (getParameterByName("scrollbartheme")) {
|
||||||
if ($(window).height() < $("main .mCSB_container").height()) {
|
if ($(window).height() < $("main .mCSB_container").height()) {
|
||||||
|
setIntervalX(function () {
|
||||||
$("main .mCSB_container").animate({
|
$("main .mCSB_container").animate({
|
||||||
top: -1 * ($("main .mCSB_container").height() - $(window).height())
|
top: -1 * ($("main .mCSB_container").height() - $(window).height())
|
||||||
}, "slow", function () {
|
}, "slow", function () {
|
||||||
$("main").mCustomScrollbar("update");
|
$("main").mCustomScrollbar("update");
|
||||||
});
|
});
|
||||||
|
}, 1000, 3);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
setIntervalX(function () {
|
||||||
$("main").animate({ scrollTop: $("#chatcontent").height() }, "slow");
|
$("main").animate({ scrollTop: $("#chatcontent").height() }, "slow");
|
||||||
|
}, 1000, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user