Skip to content

Commit 749dd26

Browse files
committed
Merge pull request defunkt#11 from littke/master
Added a 'clickedElement' options var, referencing the clicked element.
2 parents b2ffdae + fa7bb15 commit 749dd26

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

README

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,15 @@ The $(link).pjax() function accepts a container, an options object,
7171
or both. The options are the same as jQuery's $.ajax options with the
7272
following additions:
7373

74-
container - The selector of the container to load the reponse body into, or
75-
the container itself.
76-
push - Whether to pushState the URL. Defaults to true (of course).
77-
replace - Whether to replaceState the URL. Defaults to false.
78-
timeout - pjax sets this low, <1s. Set this higher if using a custom
79-
error handler. It's in ms, so something like `timeout: 2000`
80-
error - By default this callback reloads the target page once `timeout`
81-
ms elapses.
74+
container - The selector of the container to load the reponse body into, or
75+
the container itself.
76+
clickedElement - The element that was clicked to start the pjax call.
77+
push - Whether to pushState the URL. Defaults to true (of course).
78+
replace - Whether to replaceState the URL. Defaults to false.
79+
timeout - pjax sets this low, <1s. Set this higher if using a custom
80+
error handler. It's in ms, so something like `timeout: 2000`
81+
error - By default this callback reloads the target page once `timeout`
82+
ms elapses.
8283

8384

8485
## $.pjax( options )

jquery.pjax.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ $.fn.pjax = function( container, options ) {
3737

3838
var defaults = {
3939
url: this.href,
40-
container: $(this).attr('data-pjax')
40+
container: $(this).attr('data-pjax'),
41+
clickedElement: $(this)
4142
}
4243

4344
$.pjax($.extend({}, defaults, options))

0 commit comments

Comments
 (0)