Last active
May 5, 2018 22:20
-
-
Save sounisi5011/5e7561d13975ac1d4bc98ae213707201 to your computer and use it in GitHub Desktop.
hashchange run test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang=ja> | |
<meta charset=utf-8> | |
<meta name=viewport content="width=device-width,initial-scale=1"> | |
<meta name=format-detection content="telephone=no,email=no,address=no"> | |
<title>hashchange run test</title> | |
<link rel=preload href=main.css as=style> | |
<link rel=preload href=main.js as=script> | |
<link href=main.css rel=stylesheet> | |
<body> | |
<ul> | |
<li><a href="#x1">#x1</a></li> | |
<li><a href="#x2">#x2</a></li> | |
<li><a href="#x3">#x3</a></li> | |
</ul> | |
<p id=x1>x1</p> | |
<p id=x2>x2</p> | |
<p id=x3>x3</p> | |
<p>EOD</p> | |
<script src=main.js></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p { | |
margin-top: 50em; | |
margin-top: 50vh; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener('hashchange', function(event) { | |
var bodyElem = document.body; | |
bodyElem.appendChild(document.createElement('br')); | |
bodyElem.appendChild(document.createTextNode('[' + (new Date) + ']: ' + location.hash)); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment