Replace state on initial page load so it's reloadable on popstate

This commit is contained in:
Adam Wathan 2017-11-16 17:30:24 -05:00
parent 2f1d89dcd9
commit 5ad847b113
3 changed files with 12 additions and 1 deletions

View file

@ -1,4 +1,11 @@
$.when($.ready).then(function() {
window.history.replaceState({
'href': window.location.href,
'title': $(document).filter('title').text(),
'nav': $(document).find('#nav').html(),
'content': $(document).find('#content').html()
}, '', window.location.href)
$('#nav').on('click', 'a', function (event) {
// Allow opening links in new tabs

View file

@ -14,6 +14,10 @@
<meta property="og:image" content="https://tailwindcss.com/img/twitter-card.png" />
@endsection
@push('headScripts')
<script src="{{ mix('/js/nav.js') }}"></script>
@endpush
@section('body')
<div class="min-h-screen">
<div id="sidebar" class="hidden z-50 fixed pin-y pin-l overflow-y-scroll md:overflow-visible scrolling-touch md:scrolling-auto bg-smoke-light w-4/5 md:w-full md:max-w-xs flex-none border-r-2 border-smoke md:flex flex-col">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="{{ mix('/css/main.css') }}">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="{{ mix('/js/nav.js') }}"></script>
@stack('headScripts')
</head>
<body data-sidebar-visible="true" class="font-sans font-normal text-slate-darker leading-normal">