Skip to content
Permalink
Browse files

Scroll to top on fresh load

Should address #25.
  • Loading branch information...
connor-bracewell committed Jul 28, 2019
1 parent bb8dbbc commit d8e1546c38263f71ea4c6a0b0eb05c5f84fc235f
Showing with 10 additions and 2 deletions.
  1. +3 −2 src/index.mustache
  2. +7 −0 src/ts/main.ts
@@ -4,11 +4,12 @@
<title>co.nnor.bracewell</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#22222a" />
<meta charset="UTF-8" />
<link rel="shortcut icon" type="image/png" href="/img/favicon.png" />
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link href="https://fonts.googleapis.com/css?family=Maven+Pro:400,700%7CDroid+Serif:400,700" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script>
<script src="/js/main.js"></script>
<script src="js/main.js"></script>
</head>
<body>

@@ -111,6 +111,13 @@ $(document).ready(function() {
});
*/

// Scroll the viewport back to the top. This is necessary since anchored links
// move the viewport before the above scripts run and the page is re-drawn.
if (window.performance && performance.navigation.type !== 1) {
// If we can detect the load type and it wasn't a reload:
window.scrollTo(0,0);
}

// Give the lightbox elements a name since they are used multiple times.
let overlayEl = $(".lightbox-overlay");

0 comments on commit d8e1546

Please sign in to comment.
You can’t perform that action at this time.