Asynchronous switch functions (Make sure the DOM is parsed after switching) (#79)
* Make sure the DOM is parsed after switching * Fix reload-link in the example
This commit was merged in pull request #79.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user