Fix documentation for currentUrlFullReload

This commit is contained in:
Behind The Math
2018-03-20 18:43:05 -04:00
parent 494f1f35ac
commit dddb4dd2fb
2 changed files with 8 additions and 2 deletions

View File

@@ -445,10 +445,14 @@ Enables verbose mode. Useful to debug page layout differences.
When set to true, clicking on a link that points to the current URL will trigger a full page reload. When set to true, clicking on a link that points to the current URL will trigger a full page reload.
The default is `false`, so clicking on such a link will do nothing. When set to `false`, clicking on such a link will cause Pjax to load the
current page like any page.
If you want to add some custom behavior, add a click listener to the link, If you want to add some custom behavior, add a click listener to the link,
and set `preventDefault` to true, to prevent Pjax from receiving the event. and set `preventDefault` to true, to prevent Pjax from receiving the event.
Note: this must be done before Pjax is instantiated. Otherwise, Pjax's
event handler will be called first, and preventDefault() won't be called yet.
Here is some sample code: Here is some sample code:
```js ```js
@@ -465,6 +469,8 @@ Here is some sample code:
} }
}) })
} }
var pjax = new Pjax()
``` ```
(Note that if `cacheBust` is set to true, the code that checks if the href (Note that if `cacheBust` is set to true, the code that checks if the href

View File

@@ -11,7 +11,7 @@
<h1>Index</h1> <h1>Index</h1>
Hello. Hello.
Go to <a href="page2.html" class="js-Pjax">Page 2</a> or <a href="page3.html" class="js-Pjax">Page 3</a> and view your console to see Pjax events. Go to <a href="page2.html" class="js-Pjax">Page 2</a> or <a href="page3.html" class="js-Pjax">Page 3</a> and view your console to see Pjax events.
Clicking on <a href="index.html">this page</a> will just reload the page entirely. Clicking on <a href="index.html">this page</a> will do nothing.
<h2>Manual URL loading</h2> <h2>Manual URL loading</h2>