Scrolling to top when changing document

This commit is contained in:
Kasper Rynning-Tønnesen
2016-01-23 14:57:18 +01:00
parent 21812eab1e
commit 98ed693ffb
4 changed files with 9 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -365,6 +365,8 @@ window.onpopstate = function(e){
function onepage_load(){ function onepage_load(){
$("#channel-load").css("display", "block"); $("#channel-load").css("display", "block");
window.scrollTo(0, 0);
var url_split = window.location.href.split("/"); var url_split = window.location.href.split("/");
if(url_split[3] == "" || url_split[3].substring(0,1) == "#"){ if(url_split[3] == "" || url_split[3].substring(0,1) == "#"){
$.ajax({ $.ajax({

View File

@@ -202,7 +202,8 @@ var Nochan = {
to_channel: function(chan, popstate){ to_channel: function(chan, popstate){
$("#channel-load").css("display", "block"); $("#channel-load").css("display", "block");
window.scrollTo(0, 0);
$.ajax({ $.ajax({
url: chan + "/php/channel.php", url: chan + "/php/channel.php",
success: function(e){ success: function(e){
@@ -325,6 +326,7 @@ $(document).on('click', '#toast-container', function(){
$(document).on('click', ".chan-link", function(e){ $(document).on('click', ".chan-link", function(e){
e.preventDefault(); e.preventDefault();
Nochan.to_channel($(this).attr("href"), false); Nochan.to_channel($(this).attr("href"), false);
}); });
@@ -333,6 +335,7 @@ $(".listen-button").click(function(e){
if($(".room-namer").val() == ""){ if($(".room-namer").val() == ""){
e.preventDefault(); e.preventDefault();
//window.location = "?chan="+ //window.location = "?chan="+
Nochan.to_channel($(".room-namer").attr("placeholder")); Nochan.to_channel($(".room-namer").attr("placeholder"));
} }
}); });