JSFiddle - React, Tailwind, and code Playground

by cillay

HTML

<body>
    <a href="#1">1</a>
    <a href="#2">2</a>
</body>

CSS

body {
    margin: 40px;
}
a {
    display: block;
    width: 200px;
    text-align: center;
    font-family: "Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace;
    font-size: 48px;
    text-decoration: none;
    color: black;
    background-color: #e5e5e5;
    border: 1px solid #000099;
    margin-bottom: 10px;
}

JavaScript

$.getScript('https://raw.github.com/cowboy/jquery-hashchange/v1.3/jquery.ba-hashchange.min.js', function() {
    // Bind the event.
    $(window).hashchange(function() {
        // Alerts every time the hash changes!
        if (location.hash) {
            alert(location.hash);
        }
    });
    // Trigger the event (useful on page load).
    $(window).hashchange();
});