Scroll sidebar in case if the channel is not in view

This commit is contained in:
Jeremy Zhang 2017-11-01 06:43:12 +00:00
parent 0ffaf41874
commit 17ded0a3bd

View File

@ -663,6 +663,9 @@
if (selected_channel != channel_id && guild_channels[channel_id] && guild_channels[channel_id].read) { if (selected_channel != channel_id && guild_channels[channel_id] && guild_channels[channel_id].read) {
if (animate_it) { if (animate_it) {
$("#guild-btn").sideNav("show"); $("#guild-btn").sideNav("show");
if (!element_in_view($("#channel-"+channel_id), true)) {
$("#guild-nav").animate({ scrollTop: $(document).height() }, "fast");
}
flashElement($("#channel-"+channel_id)); flashElement($("#channel-"+channel_id));
setTimeout(function () { setTimeout(function () {
$("#guild-btn").sideNav("hide"); $("#guild-btn").sideNav("hide");