Add custom scrollbar

This commit is contained in:
Jeremy Zhang
2018-08-08 02:05:06 +00:00
parent cc2ea3d68b
commit e820587e15
4 changed files with 167 additions and 3 deletions

View File

@ -48,9 +48,19 @@ html {
}
}
body, #overall-main-content {
height: 100vh;
}
#overall-main-content {
overflow-y: hidden;
}
main {
overflow-y: scroll;
min-height: calc(100vh - 80px);
overflow-x: hidden;
height: 100%;
}
footer {
@ -172,7 +182,7 @@ nav .brand-logo {
padding-left: 1%;
padding-top: 1%;
padding-bottom: 40px;
margin-bottom: 13px;
margin-bottom: 90px;
word-wrap: break-word;
}

View File

@ -328,7 +328,7 @@
if (!has_already_been_initially_resized) {
has_already_been_initially_resized = true;
if (has_handled_noscroll) {
$("html, body").animate({ scrollTop: $(document).height() }, "fast");
$("main").mCustomScrollbar("scrollTo", "bottom", {scrollEasing:"easeOut"});
} else {
has_handled_noscroll = true;
Materialize.toast('Continue scrolling to read on...', 5000);
@ -352,6 +352,21 @@
}
});
var showScrollbar = getParameterByName("showscrollbar") == "true";
if (showScrollbar) {
showScrollbar = 2;
} else {
showScrollbar = 0;
}
var scrollbarTheme = getParameterByName("scrollbartheme");
if (!scrollbarTheme) {
scrollbarTheme = "light";
}
$("main").mCustomScrollbar({
alwaysShowScrollbar: showScrollbar,
theme: scrollbarTheme
});
if (disabled) {
Materialize.toast('This server is currently disabled. If you are an administrator of this server, please get in touch with a TitanEmbeds team member to lift the ban.', 100000);
return;
@ -1304,12 +1319,17 @@
if ($("#chatcontent p:last-child.mentioned").length) {
play_notification_sound("mention");
}
if (replace == null && jumpscroll) {
if (!has_handled_noscroll) {
has_handled_noscroll = true;
Materialize.toast('Continue scrolling to read on...', 5000);
} else {
$("html, body").animate({ scrollTop: $(document).height() }, "slow");
$("main .mCSB_container").animate({
top: -1 * ($("main .mCSB_container").height() - $(window).height())
}, "slow", function () {
$("main").mCustomScrollbar("update");
});
}
}
$('#chatcontent').linkify({