Asynchronous switch functions #79

Merged
oskarrough merged 2 commits from async-onswitch into master 2017-12-19 07:58:23 -05:00
4 changed files with 5 additions and 3 deletions

View File

@@ -19,7 +19,8 @@ document.addEventListener("pjax:success", function() {
document.addEventListener("DOMContentLoaded", function() {
var pjax = new Pjax({
selectors: [".body"],
elements: [".js-Pjax"],
selectors: [".body"]
// currentUrlFullReload: true,
})
console.log("Pjax initialized.", pjax)

View File

@@ -10,7 +10,7 @@
<div class='body'>
<h1>Index</h1>
Hello.
Go to <a href='page2.html'>Page 2</a> and view your console to see Pjax events.
Go to <a href='page2.html' class="js-Pjax">Page 2</a> and view your console to see Pjax events.
Clicking on <a href='index.html'>this page</a> will just reload the page entierly.
</div>
</body>

View File

@@ -9,7 +9,7 @@
<body>
<div class='body'>
<h1>Page 2</h1>
Hello. Go to <a href='index.html'>Index</a>.
Hello. Go to <a href='index.html' class="js-Pjax">Index</a>.
</div>
</body>
</html>

View File

@@ -77,6 +77,7 @@ Pjax.prototype = {
},
onSwitch: function() {
this.parseDOM(document)
trigger(window, "resize scroll")
},